Bug: playback bot does not kill itself after sample was deleted from disk
Closed this issue · 2 comments
Describe the bug
The playback bot should kill itself if it tries to reread it's sample file but it was deleted.
This condition is detected well, but not executed in shutdownBot()
; currently he runs on forever.
fgcom-mumble/server/fgcom-radio-playback.bot.lua
Lines 198 to 215 in 92ec5c6
To Reproduce
Steps to reproduce the behavior:
- Start a new ATIS recording
- delete the generated FGCS sample file
- Observe the bot surviving
Expected behavior
Playback-bot should kill itself in shutdownBot()
, but it somehow hangs in that function...
Logfiles
transmit next sample
eos=true
cdc=4
dta=160
transmit ok
no samples left, playback complete
playback timer: tick
Looped timer: update voice buffer from file
'./recordings/fgcom.rec.ZZZZ-123.4500.fgcs' not readable or no FGCS file, probably deleted from filesystem.
shutdownBot(): requested
playback timer: tick
playback timer: tick
playback timer: tick
playback timer: tick
Hm, could this potentially be linked to the addition where the API was switched to blocking calls?
It somehow behaves similar to the thread blocking issues I had some time ago.
Specifically it seems to be blocking when calling client:sendPluginData
in the shutdown function.
The call to updateAllChannelUsersforSend()
does succeed and return, as one can easily see when adding another log statement.
An easy quick-and-dirty fix is to shutdown hard at the beginning of the function, but that leads to stale data in the clients (which will be removed when the client side garbage collector kicks in; but thats not an ideal fix):
shutdownBot = function()
fgcom.log("shutdownBot(): requested")
updateAllChannelUsersforSend(client)
os.exit(0)
...
What is really strange is, that this only happens in the case where the file gets deleted from disk.
The other cases terminate quite nicely!
It even terminates nicely when adding shutdownBot()
in front of the if check for the lastHeader.