OS2 World Community Forum
OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Jochen Schäfer on July 31, 2015, 07:34:33 am
-
Hi.
I'm porting nginx. I was able to build a binary and nginx can serve me static HTML pages.
I can stop nginx via process signaling. That just works fine.
But if I want to restart nginx, I get the following:
nginx: [alert] shmget(384) failed (22: Invalid argument)
LIBC PANIC!!
safesem mutex requested failed, rc=0x6. pmtx=5fe10960:{.hmtx=0x800100fb .fShared
=0x1}
pid=0x0fbb ppid=0x0b43 tid=0x0001 slot=0x009c pri=0x0200 mc=0x0001 ps=0x0017
U:\WORK\NGINX\OBJS\NGINX.EXE
Process dumping was disabled, use DUMPPROC / PROCDUMP to enable it.
Now, I have to reboot to get nginx running again.
I have the newest klibc installed and the binary is compiled with gcc 4.9.2.
Does anyone have suggestions, how to handle the problem?
Bye Jochen
PS: If someone wants to test the port, PM me. I'll send you the binary.
-
Try adding -Zhigh-mem to your LDFLAGS
-
I have already compiled nginx with -Zhigh-mem.
Actually, I used:
CFLAGS = -D__EMX__ -DEMX -DOS2 -Zmt -D__ST_MT_ERRNO__ -g -march=pentium -mtune=pentium4 -static-libgcc
and
LDFLAGS = -Zomf -Zmap -Zhigh-mem -Zstack 8000 -D__ST_MT_ERRNO__ -static-libgcc -lmmap -Zexe
-
All libc panics I had with Java had to do with a short of available memory. I don't know if this is the same in your situation.
-
I don't think, it's an memory problem. The problem is consistently the start of nginx after a previous shutdown.
The nginx code for the use of shared memory relies on the automatic removal of shared memory at process shutdown.
My guess is, that klibc ignores this flag and by the time nginx is started the second time, the shared semaphore is still in use and can't be recreated.
That leads to the lib panic.
Does someone know whether I can fetch a list of shared memory segments to release?
-
I know WatchCat can show semaphores per process.
Can also maybe Theseus 4 be useful?
ftp://ftp.boulder.ibm.com/ps/products/os2/fixes/v4.5warp/theseus4/thes4001.exe
By the way, I sent you a PM some time ago...
PS: If someone wants to test the port, PM me. I'll send you the binary.
-
Hi Boris.
Thanks for the hints. Imwill look into the tools.
I didn't forget your PM, I just didn't get to packaging and uploading the binary. Sorry.
Hope to get to it this evening.
-
What does -D__ST_MT_ERRNO__ do? I have recently come across it and couldn't determine what its purpose was.
-
What does -D__ST_MT_ERRNO__ do? I have recently come across it and couldn't determine what its purpose was.
On EMX, it was needed when using the multithreading version of the library along with -Zmt. Now it is just a no-op as kLIBC only supports multi-threading. (Programs aimed at DOS had to be single threaded)