tmedicci commented on issue #9241:
URL: https://github.com/apache/nuttx/issues/9241#issuecomment-1542697730

   Hi @pussuw , thanks for reporting...
   
   > It seems like there is a regression with sockets after PR 
https://github.com/apache/nuttx/pull/8985 . At least local sockets are 
affected, did not test others.
   
   It seems it affects only local sockets because it uses a FIFO to exchange 
data. BTW, it can be checked using `sim:ustream`:
   
   ```
   nsh> server &
   server [4:100]
   nsh> server: Accepting connections on /dev/fifo ...
   
   nsh> client 
   client: Connecting to /dev/fifo...
   ```
   > I'm not sure how to fix this properly so this is why I brought this up. I 
think there is straight up a logic error there, I don't think allocating FIFOs 
for sockets should block, ever.
   
   I couldn't figure out how to fix this yet (and, also, I'm not that familiar 
with the local sockets). But the problem itself can be described as:
   
   - 
[`local_accept`](https://github.com/apache/incubator-nuttx/blob/75ecbd4382d57580af251bb55e45b7ef207564b7/net/local/local_accept.c#L98)
 (the server side): doesn't try to open the FIFO if there are no waiters (that 
is, some client trying to connect). It keeps waiting for `local_waitlisten`, 
which is a semaphore, basically.
   - 
[`local_open_client_tx`](https://github.com/apache/incubator-nuttx/blob/82e2e4124a3485f827926298d35e703027d16e13/net/local/local_connect.c#L109)
 blocks trying to open the FIFO.
   - 
[`local_waitlisten`](https://github.com/apache/incubator-nuttx/blob/75ecbd4382d57580af251bb55e45b7ef207564b7/net/local/local_accept.c#L48)
 only returns after `local_open_client_tx` returns (and it won't return if no 
server-sided FIFO opens), specifically 
[here](https://github.com/apache/incubator-nuttx/blob/82e2e4124a3485f827926298d35e703027d16e13/net/local/local_connect.c#L132).
   
   > If someone tells me how it SHOULD work I'll happily fix it.
   
   I'd say, preliminary, that this new behavior of FIFO possibly changes the 
logic of waiting at `local_waitlisten` or opening the client side after 
notifying the server that it also can open the server side of that same FIFO. 
   
   I accept more ideas on how to handle it properly ;)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to