Fork us on GitHub Follow us on Facebook Follow us on Twitter

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#456 closed defect (fixed)

Cannot receive and send over TCP/UDP at the same time

Reported by: Jiri Svoboda Owned by:
Priority: major Milestone: 0.5.0
Component: helenos/net/socket Version: mainline
Keywords: Cc:
Blocker for: Depends on:
See also: #441

Description (last modified by Jiri Svoboda)

The socket client code for recv()/accept() works in a non-blocking fashion: the socket provided sends a notification that new data/connection has arrived and the client calls recv/accept IPC method, which returns immediately.

In current TCP/UDP reception is blocking. This is adapted to the socket API using a hack: a fake notification is sent in advance, the client, when recv()/accept() is called, immediately proceeds to the IPC call, which blocks until data/connection actually arrives.

The problem:

  • while in IPC call for recv()/accept() the socket client code holds the global socket lock
  • while in {tcp|udp}_uc_recv() the socket provider code holds the socket's lock

This means it is not possible to send data while being blocked in recv() at the same time. It is also not possible to wait for data from multiple connections simultaneously (i.e. serve multiple connections from a single task).

Change History (7)

comment:1 Changed 7 years ago by Jiri Svoboda

Description: modified (diff)

comment:2 Changed 7 years ago by Jiri Svoboda

Component: helenos/unspecifiedhelenos/net/socket

comment:3 Changed 7 years ago by Jiri Svoboda

In mainline,1491 I put in a fix/hack in TCP socket provider to make reception non-blocking (it is using an extra receive fibril/bufffer). The problem with accept and UDP receive remains.

comment:4 Changed 7 years ago by Jakub Jermář

Milestone: 0.5.00.5.1

Based on the 0.5.0 release bug court ruling, retargetting to 0.5.1.

comment:5 Changed 7 years ago by Jiri Svoboda

I was mistaken, accept in TCP works asynchronously. Only UDP needs more work.

comment:6 Changed 7 years ago by Jiri Svoboda

Milestone: 0.5.10.5.0
Resolution: fixed
Status: newclosed

Fixed in mainline,1521. Added a receive fibril for the UDP socket. Again this is not very pretty and should be replaced in the future.

comment:7 Changed 7 years ago by Jiri Svoboda

See also: #441
Note: See TracTickets for help on using tickets.