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

PI nanomsg hangs if the corresponding switch crashes #178

Closed
fruffy opened this issue Apr 5, 2023 · 2 comments · Fixed by #183
Closed

PI nanomsg hangs if the corresponding switch crashes #178

fruffy opened this issue Apr 5, 2023 · 2 comments · Fixed by #183

Comments

@fruffy
Copy link
Contributor

fruffy commented Apr 5, 2023

I have been successfully using nanomsg instead of virtual interfaces to run simple switch. An example is this PR:
p4lang/p4c#3951
However, there is one problem. If simple_switch crashes, the nn framework seems to get stuck at this point:

self.packet_inject.port_remove(self.port_number)

It tries to remove the port but does not get a response back, presumably because the socket is blocking indefinitely? Is there a straightforward way to fix this?

@antoninbas
Copy link
Member

It's not supported by PTF currently, but I would recommend the gRPC service for injecting packets (https://github.com/p4lang/behavioral-model/blob/main/services/p4/bm/dataplane_interface.proto), instead of the nanomsg socket. You could consider adding that support to PTF...

The nanomsg stuff we use doesn't seem to be actively maintained any more. There are new implementations (both for the core library and the Python module). I don't know if using these would help.

I could think of the following workaround (not guaranteed to work): force delete the socket files after you detect that simple_switch_grpc has crashed. I assume this is an unplanned crash (e.g. segfault), and not a signal we could trap in bmv2 to close the socket before exiting.

@fruffy
Copy link
Contributor Author

fruffy commented Apr 5, 2023

Thanks, will try to give the hack a shot.

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

Successfully merging a pull request may close this issue.

2 participants