Jetty
  1. Jetty
  2. JETTY-413

RequestLog prevents server from stopping

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.5
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      Windows XP, Sun JDK 1.5, running inside Eclipse
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      When you add a handler for the request log, it prevents the server from stopping when server.stop() is called. The server stops serving requests, but the JVM does not terminate. There's probably a thread hanging out there someplace. Here is a simple test case to reproduce the problem.

      public static void main(String[] args) throws Exception {
      Server server = new Server();

      RequestLogHandler requestLogHandler = new RequestLogHandler();
      NCSARequestLog requestLog = new NCSARequestLog("/temp/yyyy_mm_dd.request.log");
      requestLogHandler.setRequestLog(requestLog);

      HandlerCollection handlers = new HandlerCollection();

      // comment out this line and the problem goes away
      handlers.setHandlers(new Handler[]

      {new DefaultHandler(), requestLogHandler}

      );

      server.setHandler(handlers);

      server.start();

      // the server stops serving requests, but it does not terminate the JVM.
      server.stop();
      }

        Activity

        Hide
        Leopoldo Agdeppa III added a comment -

        Chirs

        can you please attach the stacktraces for this

        thanks
        bong

        Show
        Leopoldo Agdeppa III added a comment - Chirs can you please attach the stacktraces for this thanks bong
        Hide
        Chris Cleveland added a comment -

        No exception gets thrown, so far as I can tell. Here's the only output:

        2007-08-09 23:09:05.688::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
        2007-08-09 23:09:05.688::INFO: jetty-6.1.5
        2007-08-09 23:09:05.704::INFO: Opened C:\temp\2007_08_09.request.log

        Show
        Chris Cleveland added a comment - No exception gets thrown, so far as I can tell. Here's the only output: 2007-08-09 23:09:05.688::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 2007-08-09 23:09:05.688::INFO: jetty-6.1.5 2007-08-09 23:09:05.704::INFO: Opened C:\temp\2007_08_09.request.log
        Hide
        Leopoldo Agdeppa III added a comment -

        The bug was in of NCSARequestLog 's RolloverFileOutputStream 's Timer Thread,
        the timer thread wasnt set as a deamon thread.

        the fix was just making the timer thread as a deamon thread by using instead of Timer() which is defaulted as a non deamon thread, Timer(true) is used

        Show
        Leopoldo Agdeppa III added a comment - The bug was in of NCSARequestLog 's RolloverFileOutputStream 's Timer Thread, the timer thread wasnt set as a deamon thread. the fix was just making the timer thread as a deamon thread by using instead of Timer() which is defaulted as a non deamon thread, Timer(true) is used
        Hide
        Leopoldo Agdeppa III added a comment -

        Chris

        you can check out greg's fix from the trunk

        thanks
        bong

        Show
        Leopoldo Agdeppa III added a comment - Chris you can check out greg's fix from the trunk thanks bong
        Hide
        Peter Jodeleit added a comment -

        As far as i see, the timer instance is still without a meanigfull name.
        I would like to see something like "NCSARequestLog.timer" or "jetty.NCSARequestLog.timer" or .. in thread dumps.
        But this is a general problem in jetty code. HashSessionManager starts also a timer without name (by the way - this timer is also "non deamon").

        Are there any opinions?

        Show
        Peter Jodeleit added a comment - As far as i see, the timer instance is still without a meanigfull name. I would like to see something like "NCSARequestLog.timer" or "jetty.NCSARequestLog.timer" or .. in thread dumps. But this is a general problem in jetty code. HashSessionManager starts also a timer without name (by the way - this timer is also "non deamon"). Are there any opinions?

          People

          • Assignee:
            Leopoldo Agdeppa III
            Reporter:
            Chris Cleveland
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: