draconisPW / PWMAngband

A free, multi-player roguelike dungeon exploration game based on Angband
35 stars 11 forks source link

remove illegal input handler #621

Closed igroglaz closed 4 months ago

igroglaz commented 4 months ago

server stopped without exit_game_panic(void):

280224 054012 Odie: You see a Fortune Cookie {Freesia}.
280224 054014 Odie: You have a Fortune Cookie {Freesia} (a).
280224 054046 Odie: The cave spider wakes up.
280224 054046 Odie: You hit the cave spider for 7 damage.
280224 054046 Odie: You hit the cave spider for 7 damage.
280224 054046 Odie: You have slain the cave spider.
280224 054046 Odie: The cave spider wakes up.
280224 054047 Odie: The cave spider wakes up.
280224 054047 Odie: The cave spider wakes up.
280224 054047 Odie: You hit the cave spider for 5 damage.
280224 054047 Odie: You hit the cave spider for 7 damage.
280224 054047 Odie: You have slain the cave spider.
280224 054047 Odie: The cave spider bites you for 2 damage.
280224 054047 Odie: The cave spider bites you for 3 damage.
280224 054047 Odie: You hit the cave spider for 7 damage.
280224 054047 Odie: You hit the cave spider for 7 damage.
280224 054047 Odie: You have slain the cave spider.
280224 054048 Odie: The cave spider bites you for 4 damage.
280224 054048 Odie: *** LOW HITPOINT WARNING! ***
280224 054049 Odie: The cave spider misses you.
280224 054049 Odie: You hit the cave spider for 7 damage.
280224 054049 Odie: You hit the cave spider for 5 damage.
280224 054049 Odie: You have slain the cave spider.
280224 054050 Odie: The cave spider wakes up.
280224 054053 Odie: The cave spider bites you for 4 damage.
280224 054055 Odie: The cave spider bites you for 3 damage.
280224 054055 Odie: The cave spider wakes up.
280224 054055 Odie: You hit the cave spider for 7 damage.
280224 054055 Odie: You hit the cave spider for 7 damage.
280224 054055 Odie: You have slain the cave spider.
280224 054056 Odie: The cave spider bites you for 4 damage.
280224 054058 Odie: The cave spider bites you for 2 damage.
280224 054058 Odie: You hit the cave spider for 6 damage.
280224 054058 Odie: You hit the cave spider for 6 damage.
280224 054058 Odie: You have slain the cave spider.
280224 054120 remove illegal input handler fd -1

no more logs.

draconisPW commented 4 months ago

A negative value for fd in remove_input() provokes an exit(1) which stops the server immediately. As for why this happened... I have absoletely no idea :(

draconisPW commented 4 months ago

Try to put a breakpoint on the "plog_fmt("remove illegal input handler fd %d", fd);" line in sched-win.c, if the problem happens again you will have the call stack to see where the problem comes from. In that case post a short video on your YT channel like you always do so we can investigate further.

igroglaz commented 4 months ago

https://youtu.be/JqOdH6kuneQ

draconisPW commented 4 months ago

Could happen randomly if the user presses Q to quit at the same time the input handler processes the quit packet. The do_quit() method is called twice, closes the socket and then tries to close it again generating a useless error message. Just need to add a check so that if the socket is already closed do_quit just does nothing.

(easily spotted on the video because the quit_msg of the connp is already set to "Client quit" meaning the player already pressed Q and the game is waiting for the 5 second timeout to complete to log off the character)

draconisPW commented 4 months ago

Fixed in commit 66b64bb.