wwivbbs / wwiv

WWIV BBS Software v5
http://www.wwivbbs.org
Other
186 stars 71 forks source link

network semaphore not cleaning up #1137

Closed granitepenguin closed 6 years ago

granitepenguin commented 6 years ago

OS Linux WWIV 2807

The system is not cleaning up the semaphore file, which is causing runs of network to fail

wwiv@beaglebbs:~$ ./network -n1 .0 --v=3                                        
2018-07-28 13:48:09317 VER-1 Ignoring dot argument since no mapping is defined by the application.
2018-07-28 13:48:09318 VER-3 SH_OPEN /bbs/wwiv/config.dat, access=0
2018-07-28 13:48:09318 VER-3 SH_OPEN /bbs/wwiv/config.dat, access=0, handle=3
2018-07-28 13:48:09318 VER-3 CLOSE /bbs/wwiv/config.dat, handle=3
2018-07-28 13:48:09318 VER-3 SH_OPEN /bbs/wwiv/data/networks.dat, access=0
2018-07-28 13:48:09319 VER-3 SH_OPEN /bbs/wwiv/data/networks.dat, access=0, handle=3
2018-07-28 13:48:09319 VER-3 CLOSE /bbs/wwiv/data/networks.dat, handle=3
2018-07-28 13:48:09320 VER-3 ReadFileIntoString:
2018-07-28 13:48:09320 INFO  ./network [5.4.0.2807] for network: wwivnet
2018-07-28 13:48:09320 INFO  USE networkb: bbs.weather-station.org:24556
2018-07-28 13:48:09321 INFO  Executing Command: '/bbs/wwiv/networkb --send --net=0 --node=1 --v=3'
2018-07-28 13:48:09323 VER-3 SH_OPEN /bbs/wwiv/config.dat, access=0
2018-07-28 13:48:09324 VER-3 SH_OPEN /bbs/wwiv/config.dat, access=0, handle=3
2018-07-28 13:48:09324 VER-3 CLOSE /bbs/wwiv/config.dat, handle=3
2018-07-28 13:48:09324 VER-3 SH_OPEN /bbs/wwiv/data/networks.dat, access=0
2018-07-28 13:48:09325 VER-3 SH_OPEN /bbs/wwiv/data/networks.dat, access=0, handle=3
2018-07-28 13:48:09325 VER-3 CLOSE /bbs/wwiv/data/networks.dat, handle=3
2018-07-28 13:48:09325 VER-3 ReadFileIntoString:
2018-07-28 13:48:09326 INFO  /bbs/wwiv/networkb [5.4.0.2807] for network: wwivnet
2018-07-28 13:48:09326 VER-3 SemaphoreFile::try_acquire: 'nets/wwivnet/networkb.bsy'
2018-07-28 13:48:39331 ERROR ERROR: [networkb]: Unable to Acquire Network Semaphore: nets/wwivnet/networkb.bsy

If I manually delete the semaphore, I can get one run out of it, but that's it.

This happens if I start ./bbs. I only get one run and then it's stuck.

wwiv commented 6 years ago

wht's thelog entries for the session for the one before this that left the semaphore orphaned

wwiv commented 6 years ago

ok, got it to reproduce under strace... looks like the other side has the connection closed and we get a SIGPIPE so never clean up.

open("networkb.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 5
lseek(5, 0, SEEK_END)                   = 38879
flock(5, LOCK_EX)                       = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=38879, ...}) = 0
write(5, "2018-07-28 21:46:33415 VER-1    "..., 58) = 58
close(5)                                = 0
write(2, "2018-07-28 21:46:33415 VER-1    "..., 57) = 57
write(2, "\n", 1)                       = 1
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=127, ...}) = 0
open("networkb.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 5
lseek(5, 0, SEEK_END)                   = 38937
flock(5, LOCK_EX)                       = 0
fstat(5, {st_mode=S_IFREG|0644, st_size=38937, ...}) = 0
write(5, "2018-07-28 21:46:33415 VER-1    "..., 74) = 74
close(5)                                = 0
write(2, "2018-07-28 21:46:33415 VER-1    "..., 73) = 73
write(2, "\n", 1)                       = 1
sendto(4, "\200S\7Error (NETWORKB-0001): Unexpe"..., 85, 0, NULL, 0) = -1 EPIPE (Broken pipe)
--- SIGPIPE {si_signo=SIGPIPE, si_code=SI_USER, si_pid=31324, si_uid=1002} ---
+++ killed by SIGPIPE +++
wwiv commented 6 years ago

Should be fixed in https://github.com/wwivbbs/wwiv/commit/59f18b8d371e7cb55b359db60c354c616150355b