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

Segfault with WebSocket #1384

Closed
o3o opened this Issue Jan 28, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@o3o

o3o commented Jan 28, 2016

After update vibe.d to v0.7.27-beta.1-7-g5dff616, suddenly my app crash.

I use WebSocket, and the problem is on

void getWS(int ct, string action, scope WebSocket socket) {
  auto t = runTask({
       logInfo("CONN %s", trayNum);
       while (socket.connected) {
          ....
       }
  });

  while (socket.waitForData) {   // <- issue is here
       ....
  }
  t.join();
}

The error was generated in source/vibe/core/drivers/libevent2_tcp.d line 297

  if (dataAvailableForRead) return true;
  if (m_ctx.state != ConnectionState.open) return false;

If I add an assert:

  if (dataAvailableForRead) return true;
  assert(m_ctx !is null, "mctx is NULL!!!");
  if (m_ctx.state != ConnectionState.open) return false;

I get this message:

Task terminated with unhandled exception: mctx is NULL!!!
core.exception.AssertError@source/vibe/core/drivers/libevent2_tcp.d(302): mctx is NULL!!!

I solved my problem with this patch:

                if (dataAvailableForRead) return true;
-               if (m_ctx.state != ConnectionState.open) return false;
+               if ((m_ctx is null) || m_ctx.state != ConnectionState.open) return false;

                acquireReader();

Thank you

@s-ludwig s-ludwig added the bug label Jan 29, 2016

@s-ludwig

This comment has been minimized.

Show comment
Hide comment
@s-ludwig

s-ludwig Jan 29, 2016

Member

Fixed by 4b192bd (I hit the same issue yesterday). Thanks for investigating!

Member

s-ludwig commented Jan 29, 2016

Fixed by 4b192bd (I hit the same issue yesterday). Thanks for investigating!

@s-ludwig s-ludwig closed this Jan 29, 2016

@o3o

This comment has been minimized.

Show comment
Hide comment
@o3o

o3o Jan 29, 2016

Thank to you for your great job.

o3o commented Jan 29, 2016

Thank to you for your great job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment