CESNET/UltraGrid

An improper locking bug(e.g., deadlock) on the lock server

Closed this issue · 3 comments

Hi, developers, thank you for your checking. It seems the lock server is not released correctly when !server->initialize in the function serverStop?

serverMutexLock(server);
if (!server->initialized) {
ews_printf("Warning: Server %p was never initialized and you tried to stop it. Ignoring...\n", server);
return;
}
server->shouldRun = false;
if (server->listenerfd != INVALID_SOCKET) {
close(server->listenerfd);
}
serverMutexUnlock(server);

Hi, the upstream for EmbeddableWebServer is this repository so if you wish, you can report it there. Anyways, I am not sure if this can be considered as a bug - there can be as well assert or abort, which could be perhaps better. But from my perspective, calling stop on non-running server is a logic error. It is true, that while it continues, it shall be unlocked, anyways.

@MartinPulec Thank you for your reply. Indeed, just looking at the code, the lock server should be released anyways.
I would also report this to upstream.

Fixed, thanks for reporting!