Opened 9 years ago
Closed 17 months ago
#6956 closed defect (fixed)
GUI: LAUNCHER: ScummVM returned with unfreed signals (AmigaOS4)
Reported by: | raziel- | Owned by: | PushmePullyu |
---|---|---|---|
Priority: | normal | Component: | Port: AmigaOS4 |
Version: | Keywords: | ||
Cc: | Game: |
Description
ScummVM 1.8.0git (Nov 21 2015 06:56:08) Features compiled in: Vorbis FLAC MP3 RGB zLib MPEG2 Theora AAC FreeType2 JPEG PNG
When using scummvm with a wrong option in shell i get this warning/error message.
scummvm -version scummvm: Unrecognized option '-version' Usage: scummvm [OPTIONS]... [GAME]
Try 'scummvm --help' for more options. ***Command 'scummvm' returned with unfreed signals 30000000!
While it's not a crash or anything it shouldn't do that, i think?
AmigaOS4 - PPC - SDL - BE gcc (GCC) 4.2.4 (adtools build 20090118)
Ticket imported from: bugs/6956.
Change History (24)
comment:1 by , 8 years ago
Component: | → GUI |
---|
comment:2 by , 6 years ago
comment:3 by , 6 years ago
Component: | GUI → Port: AmigaOS4 |
---|
comment:4 by , 6 years ago
Thank you for caring about my old bug reports.
I'll go check with the os devs/sdk maintainers and report back.
comment:5 by , 6 years ago
Hmm.. http://forum.hyperion-entertainment.biz/viewtopic.php?f=26&t=590
Odd as the AmigaOS4 specific code is in backends/sdl/amigaos4 and backends/fs/amigaos4 and doesn't use AllocSignal as far as I can find. I suspect this is either a leak in the FS code or maybe in SDL.
Firstly and most importantly, @raziel- , can you still replicate this bug with the latest git master i.e. this is not an outdated bug?
comment:6 by , 6 years ago
Yes, this still happens, i just tried with latest master, though the signal number changed from my original report
*Command 'scummvm' returned with unfreed signals 1C000000!
comment:7 by , 6 years ago
If i do a "content" search over the scummvm code i can find "AllocSignal" in
backends/libbackends.o
backends/fs/amigaos4/amigaos4-fs.o
backends/fs/amigaos4/amigaos4-fs-factory.o
backends/midi/camd.o
backends/platform/sdl/amigaos/amigaos-main.o
but nowhere in the source (.cpp/.h) files, so it seems as they are being added by the system/sdk on compiling.
I can also find "FreeSignal" in
backends/libbackends.a
backends/fs/amigaos4/amigaos4-fs.o
backends/fs/amigaos4/amigaos4-fs-factory.o
backends/midi/camd.o
backends/platform/sdl/amigaos/amigaos-main.o
so it again seems that the system at least sets most of the FreeSignal() correctly (while i can't really check), except libbackends.a (instead of .o)?
comment:8 by , 6 years ago
Basically what is happening is this....
A shell runs in its own process, when you start a program from that shell
process, the program uses the shells process to execute, the shell code
goes to sleep during the program execution, when the program ends,
the shell code resumes and is ready to take another command line.
So, when the program is being executed, it's apparently allocating a signal,
such as would happen if the program was to allocate a message port or
other such activity during its operation.
However, the program is exiting without freeing all the resources it allocated,
so the shell notices this and posts the message because as the shell process
is continually reused by subsequent programs, it will eventually run out of
signals to allocate (only 16 user signals available) and all sorts of bad juju
will happen if that occurs.
So, yes, the program being run is doing something it shouldn't when it exits
in an unexpected way.
comment:9 by , 6 years ago
Summary: | LAUNCHER: ScummVM returned with unfreed signals → AMIGAOS4: Launcher - ScummVM returned with unfreed signals |
---|
comment:10 by , 6 years ago
Could this be the culprit?
https://github.com/scummvm/scummvm/blob/master/base/commandLine.cpp#L197
It doesn't seem to do any cleanup, unless i missed an atexit() somewhere.
comment:11 by , 6 years ago
That could very well be the culprit. There are no atexit() in the code, so maybe when usage is printed something is being left dangling. Will need to look at this. Beyond this, we should probably audit the codebase for exit() calls and remove / reduce the need for them down to a single call if needs be... but that is beyond the scope of just this bug.
comment:13 by , 4 years ago
Summary: | AMIGAOS4: Launcher - ScummVM returned with unfreed signals → LAUNCHER: ScummVM returned with unfreed signals (AmigaOS4) |
---|
comment:14 by , 4 years ago
Summary: | LAUNCHER: ScummVM returned with unfreed signals (AmigaOS4) → GUI: LAUNCHER: ScummVM returned with unfreed signals (AmigaOS4) |
---|
comment:16 by , 18 months ago
Unfortunately, yes
scummvm -version
scummvm: Unrecognized option '-version'
Usage: scummvm [OPTIONS]... [GAME]
Try 'scummvm --help' for more options.
*Command 'scummvm' returned with unfreed signals 0F800000!
comment:17 by , 17 months ago
Does this still happen when adding a call to g_system->destroy() just before the exit() call in base/commandLine.cpp?
comment:18 by , 17 months ago
I'll test as soon as I'm back home.
Is it as easy as adding
g_system->destroy();
or do i need to adapt that?
Thank you
comment:19 by , 17 months ago
No need to adapt it. Diff from b625def03384bd84d15b3eda3f58410c2e89f84b:
--- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -270,6 +270,7 @@ static void usage(const char *s, ...) { printf(USAGE_STRING, s_appName, buf, s_appName, s_appName); #endif + g_system->destroy(); exit(1); }
comment:20 by , 17 months ago
/me hugs @PushmePullyu
scummvm --version ScummVM 2.8.0git (Jun 20 2023 14:19:55) Using SDL backend with SDL 2.26.5 Features compiled in: Vorbis FLAC MP3 RGB zLib MPEG2 MikMod Theora VPX AAC A/52 FreeType2 FriBiDi JPEG PNG GIF cloud (servers, local) ENet SDL2 TinyGL OpenGL (with shaders)
scummvm -version scummvm: Unrecognized option '-version' Usage: scummvm [OPTIONS]... [GAME] Try 'scummvm --help' for more options.
No more unfreed signals :-)
Thank you very much
comment:21 by , 17 months ago
Thanks for testing. This should then be done in a more general way to catch all direct and indirect exit() calls. Could you try with https://github.com/PushmePullyu/scummvm/tree/amigaos-free-signals? If that works I'll PR it.
comment:22 by , 17 months ago
This works as well, thank you so much
...don't go anywhere...
/me rummaging through my bug reports
;-)
comment:23 by , 17 months ago
Wow, that was quick. Glad it fixes the bug. PR for reference: https://github.com/scummvm/scummvm/pull/5109
comment:24 by , 17 months ago
Owner: | set to |
---|---|
Resolution: | → fixed |
Status: | new → closed |
The PR has been merged, so this can be closed
That message appears to be AmigaOS4 specific, but not sure what it actually means.
@raziel-: What exactly does that warning/error mean?