Page 1 of 1

live555 exception - select() fails: Bad file descriptor, socket numbers used in the select() call: 0(r)...

Posted: 01 Feb 2022 07:56
by AdrianCT
Hi,

I am developing a QWidget that wraps VLC (3.0.16), using libvlc media player API functions to set the RTSP URL, play, pause etc.

The code compiles and I can use multiple instances of the widget in my Qt based program (WinCC OA), and I can successully play, pause and stop RTSP streams from an external media server.

However, on occasion, a fatal exception is reached in the live555 library where VLC seemingly has allocated socket 0 (reserved for stdin) to the RTSP session for some reason.

The interesting parts of the logs from WinCC OA below. I can post more -vvv logs captured on request but there is a char limit.

From starting two instances at once:
Created new TCP socket 105 for connection
Created new TCP socket 106 for connection
BasicTaskScheduler::SingleStep(): select() fails: Bad file descriptor
socket numbers used in the select() call: 0(r) 106(re) 109(r)
Odd that the socket numbers don't match (106 does but live555 gets 109 instead of 105), and this is always the case when this occurs.
At least one of the sockets don't match and socket 0 is in the list of used sockets too.

From starting a single instance (no Bad file descriptor, just crashed after socket 0 was used):
WCCOAui110:Created new TCP socket 0 for connection
WCCOAui110:[00007f73b00014c0] live555 demux error: Failed to connect with rtsp://<scrubbed_host>/live
WCCOAui110:[00007f73b00028f0] satip stream error: Failed to play RTSP session
WCCOAui110:[0000000008cd7590] main input error: Your input can't be opened
WCCOAui110:[0000000008cd7590] main input error: VLC is unable to open the MRL 'rtsp://<scrubbed_host>/live'. Check the log for details.
Any ideas why socket 0 gets allocated?

All help appreciated!

Re: live555 exception - select() fails: Bad file descriptor, socket numbers used in the select() call: 0(r)...

Posted: 01 Feb 2022 19:08
by unidan
If you have multiple playback instance using live555, then since live555 is not thread safe, it can lead to failure currently.

Re: live555 exception - select() fails: Bad file descriptor, socket numbers used in the select() call: 0(r)...

Posted: 22 Feb 2022 23:58
by AdrianCT
If you have multiple playback instance using live555, then since live555 is not thread safe, it can lead to failure currently.
Thanks for the reply and apologies for the late response.
Do you know if this is something introduced in a recent version of libVLC or live555?
We have previously been able to create multiple VLC instances within the same process without this issue a few years ago.

Re: live555 exception - select() fails: Bad file descriptor, socket numbers used in the select() call: 0(r)...

Posted: 23 Feb 2022 06:14
by mfkl
Do you know if this is something introduced in a recent version of libVLC or live555?
It might have been incidentally working until recently. Which versions did you use when it worked and when it started failing? Did your code change too?

Re: live555 exception - select() fails: Bad file descriptor, socket numbers used in the select() call: 0(r)...

Posted: 23 Feb 2022 23:12
by AdrianCT
Do you know if this is something introduced in a recent version of libVLC or live555?
It might have been incidentally working until recently. Which versions did you use when it worked and when it started failing? Did your code change too?

It was VLC 2.1 from what I can see, and it was compiled with VLC-Qt 1.2.0 sources instead of just using the libVLC includes.
It used the sources to change some class forwarding, explained here:
https://www.winccoa.com/documentation/W ... EWO_2.html

I actually found that this was not working for me though.