jersey
  1. jersey
  2. JERSEY-1090

The request scope instances may interfere occasionally when resuming an async response on the same thread.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0-m02
    • Fix Version/s: 2.0-m05, 2.0
    • Component/s: None
    • Labels:
      None

      Description

      The ResponseInvoker of the resumed request may incorrectly pick up a scope instance of the resuming request and run in a wrong scope instance.
      We need to implement a better thread-local state management in request scope that would allow running in "nested" scope instance on the same thread.

        Activity

        Hide
        Pavel Bucek added a comment - - edited

        reproducible testcase:

        --- a/examples/server-async-managed/src/main/java/org/glassfish/jersey/examples/server/async/managed/App.java
        +++ b/examples/server-async-managed/src/main/java/org/glassfish/jersey/examples/server/async/managed/App.java
        @@ -103,8 +103,9 @@ public class App {
         
                             @Override
                             public ExecutorService getRespondingExecutor() {
        -                        return Executors.newCachedThreadPool(
        -                                new ThreadFactoryBuilder().setNameFormat("custom-response-executor-%d").build());
        +                        return null;
                             }
                         }));
        Show
        Pavel Bucek added a comment - - edited reproducible testcase: --- a/examples/server-async-managed/src/main/java/org/glassfish/jersey/examples/server/async/managed/App.java +++ b/examples/server-async-managed/src/main/java/org/glassfish/jersey/examples/server/async/managed/App.java @@ -103,8 +103,9 @@ public class App { @Override public ExecutorService getRespondingExecutor() { - return Executors.newCachedThreadPool( - new ThreadFactoryBuilder().setNameFormat( "custom-response-executor-%d" ).build()); + return null ; } }));

          People

          • Assignee:
            Miroslav Fuksa
            Reporter:
            Marek Potociar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 12 hours Original Estimate - 12 hours
              12h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 20 hours
              20h