thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Joseph Evans (JIRA)" <>
Subject [jira] [Created] (THRIFT-4469) isServing is not thread safe
Date Mon, 22 Jan 2018 22:22:00 GMT
Robert Joseph Evans created THRIFT-4469:

             Summary: isServing is not thread safe
                 Key: THRIFT-4469
             Project: Thrift
          Issue Type: Bug
          Components: Java - Library
    Affects Versions: 0.11.0, 0.10.0, 0.9.3, 0.12.0, 1.0
            Reporter: Robert Joseph Evans

We have some integration tests in storm were we create a TServer and call serve on it in a
background thread, because it is a blocking call.

Then in the main thread we wait for up to 10 seconds for isServing to return success with
a 100ms sleep in between each call.

I don't know if this is a java bug or what, but in some not so rare cases isServing does not
return true during the entire 10 seconds and the test fails.  The test prints out a stack
trace when this happens and the background thread running the server is always at

happily serving.

So either we got very unlucky many times and it takes just a few ms longer than 10 seconds
to come up some times, and < 1 sec other times, or java is doing something strange some
of the time, and because Server.isServing is not volatile the checking thread caches a copy
of it in a register and never updates it during the 10 seconds of the test run.

Even if it is a java bug, which I could argue probably is, it would be good to make isServing

This message was sent by Atlassian JIRA

View raw message