nthallen / monarch

Monarch Data Acquisition System
0 stars 1 forks source link

Cygwin Unix Domain Socket Issue with Multirate TM_data_sndr() #137

Closed nthallen closed 3 years ago

nthallen commented 3 years ago

Cygwin apparently cannot handle more than one connection to a single unix domain socket from a single process. I encountered this when implementing multiple data rates in the SCoPEx PropMtr driver. The two different data rates each require their own TM_data_sndr. When both are connected, collection and PropMtr both block. I have not determined exactly what happens.

I tested this under Raspbian, and it seems to work fine.

This information should be prepared for submission to the Cygwin list.

A work-around for Cygwin would be to use TCP for this case. That would require:

nthallen commented 3 years ago

This bug has been narrowed down the case where two connect()s with non-blocking sockets are made to the same server before the caller(s) call select() to finalize the connection. Under Cygwin, the connect() process currently does not work correctly for non-blocking sockets. I have posted details to the cygwin mail list along with a minimal example program.

This is not an issue under Linux (so far verified only with Ubuntu 16.04). There the client's connect() returns success immediately if the server is listening, regardless of whether the listening socket is blocking or non-blocking.

For now, a reasonable work-around is to make Unix domain sockets blocking until after connect(). Since connecting generally occurs once at the beginning of a run, this should have no impact on our realtime performance.