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

OpenIGTLinkIF deadlocks Slicer when no server available #9

Closed
ihnorton opened this issue Jul 31, 2013 · 4 comments
Closed

OpenIGTLinkIF deadlocks Slicer when no server available #9

ihnorton opened this issue Jul 31, 2013 · 4 comments

Comments

@ihnorton
Copy link
Contributor

Starting a client connection with no server actually available seems to be problematic, at least on linux (Windows is ok, I think). When I do this, it consistently deadlocks Slicer (with flood of "Failed to connect" debug messages on the console). In one case this managed to completely freeze the ubuntu gui (mouse moved, but button pushes had no effect for >1 min.) -- had to ssh in and kill the slicer process to regain control.

@tokjun
Copy link
Contributor

tokjun commented Jul 31, 2013

Thanks for the feedback. I think we can make OpenIGTLinkIF wait for a few seconds before the next attempt to avoid the freeze. Can you try putting igtl::Sleep(1000) at line 683 in vtkMRMLIGTLConnectorNode.cxx?

else if (this->Type == TYPE_CLIENT) // if this->Type == TYPE_CLIENT
  {
  //vtkErrorMacro("vtkMRMLIGTLConnectorNode: Connecting to server...");
  int r = this->Socket->ConnectToServer(this->ServerHostname.c_str(), this->ServerPort);
  if (r == 0) // if connected to server
    {
    return 1;
    }
  else
    {
    igtl::Sleep(1000); // <- here!!
    break;
    }
  }

Another approach would be simply stop attempting to connect to the server, but I've seen some people starting the client before the server and taking advantage of the client's 'repeated trial' approach.

@ihnorton
Copy link
Contributor Author

I tried it with igtl::Sleep(100) which seems to work fine - quick enough response, but also allows the gui to keep functioning.

Also, I noticed (still on linux) that OpenIGTLinkIF does not release the socket for about 1 minute after the "active" checkbox is disabled, which prevents restarting a server on the same port in that time period. This one is not huge issue to me right now, but might be more problematic in the Slicer+PLUS use case (on same computer).

@ihnorton
Copy link
Contributor Author

Hmm. Slicer hangs when I try to uncheck the Active button on an open connector.

edit: if I kill the server and then press Active, then it doesn't hang
edit2: ok, so it is actually just hanging. if I kill the server then the gui unfreezes.

edit3: also hangs Slicer on exit, with Object::disconnect: No such slot qMRMLSceneModel::onDeviceVisibilityModified(vtkObject*) until the server is killed.

ihnorton added a commit to ihnorton/OpenIGTLinkIF that referenced this issue Jul 31, 2013
@tokjun tokjun closed this as completed in 8eba1c5 Aug 6, 2013
tokjun added a commit that referenced this issue Aug 6, 2013
@ihnorton
Copy link
Contributor Author

ihnorton commented Aug 6, 2013

Can you wait to bump the Slicer version for a few days? I will try to fix the hanging problem.

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

2 participants