Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sockets are not thread-safe #8

Open
tabascoeye opened this issue Jun 17, 2014 · 1 comment
Open

sockets are not thread-safe #8

tabascoeye opened this issue Jun 17, 2014 · 1 comment

Comments

@tabascoeye
Copy link
Owner

When a socket is used from different tasks at the same time, the stack behavior is basically undefined.

To slowly work towards the goal of having a thread-safe stack that is still "light weight", we'll try to do the following bits:

  • first allow another Task to close a socket that is blocking in accept(), connect() or select()
  • analyze what would be necessary to make it fully independent:
    • the api_message interface is waiting for a op_completed semaphore and it cannot be determined what operation has completed when multiple ones where started
    • check for possible raceb conditions in the stack
@tabascoeye
Copy link
Owner Author

found another possible race condition when using sockets from multiple thread contexts:
the setsockopt calls are handled via a tcpip_callback() so it can happen that the stack only processes them when the socket itself is already closed.
Then, inside the lwip_setsockopt_internal() function, writes to NULL pointers are made on sock->conn->pcb.ip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant