Skip to content

Commit

Permalink
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -61,9 +61,15 @@ public void handle(HttpExchange httpExchange) {
try {
final StringBuilder builder = new StringBuilder();

final Thread serverThread = Thread.currentThread();

context.getSafepointManager().pauseAllThreadsAndExecuteFromNonRubyThread(false, new SafepointAction() {
@Override
public void run(DynamicObject thread, Node currentNode) {
if (Thread.currentThread() == serverThread) {
return;
}

try {
Backtrace backtrace = context.getCallStack().getBacktrace(null);

3 comments on commit 518703d

@eregon
Copy link
Member

@eregon eregon commented on 518703d Mar 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? The thread there is not registered with the SafepointManager and should never appear (it's not a "Ruby thread"). What would be the value of the thread variable?

Sorry, something went wrong.

@eregon
Copy link
Member

@eregon eregon commented on 518703d Mar 3, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems the bug is caused by the buggy context.getThreadManager().getCurrentThread().

Sorry, something went wrong.

@chrisseaton
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just looked to me like enterThread always registers the current thread as a Ruby thread. I wasn't sure if that was intentional or not.

Please sign in to comment.