Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-10547

Windows service can't start if Windows Application Event log is full

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • None
    • Windows XP

      If the windows event log is full and jenkins in installed as a service the service will start and then straight away stop.
      Nothing appears in any log files.

      When I changed the event log setting from over write if older 7 day to over write as necessary the service started as expected.

          [JENKINS-10547] Windows service can't start if Windows Application Event log is full

          millergarym created issue -
          millergarym made changes -
          Description Original: Is the windows event log is full and jenkins in installed as a service the service will start and then start away stop.
          Nothing appears in any log files.

          When I changed the event log setting from over write if older 7 day to over write as necessary the service started as expected.
          New: If the windows event log is full and jenkins in installed as a service the service will start and then straight away stop.
          Nothing appears in any log files.

          When I changed the event log setting from over write if older 7 day to over write as necessary the service started as expected.
          Summary Original: Windows service can't start in Windows Application Event log is full New: Windows service can't start if Windows Application Event log is full

          Daniel Beck added a comment -

          Could someone please explain why this is a Jenkins bug?

          Does it still occur on recent Jenkins versions and Windows versions?

          Daniel Beck added a comment - Could someone please explain why this is a Jenkins bug? Does it still occur on recent Jenkins versions and Windows versions?

          evernat added a comment - - edited

          In my opinion, it was a Jenkins bug, because it caused Jenkins to not start and Jenkins did not say why, causing much mystery quite often.
          When Jenkins starts ok, it adds following events:

          • envar JENKINS_HOME=...
          • Starting ...\bin\java -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "...\jenkins.war"
          • Service started successfully.

          That said, it seems that Microsoft has understood the problem. Since Vista, the maximum event log size is bigger.
          And I suppose that XP is not supported any more.

          evernat added a comment - - edited In my opinion, it was a Jenkins bug, because it caused Jenkins to not start and Jenkins did not say why, causing much mystery quite often. When Jenkins starts ok, it adds following events: envar JENKINS_HOME=... Starting ...\bin\java -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "...\jenkins.war" Service started successfully. That said, it seems that Microsoft has understood the problem. Since Vista, the maximum event log size is bigger. And I suppose that XP is not supported any more.

          Daniel Beck added a comment -

          I checked the EventLogger class in .NET, it doesn't look like failure to log (assuming this isn't considered out of memory or otherwise fatal) should affect anything.

          Is there a way to easily reproduce this? Write a tool that spams event log until it crashes, then try to start Jenkins installed as service?

          Daniel Beck added a comment - I checked the EventLogger class in .NET, it doesn't look like failure to log (assuming this isn't considered out of memory or otherwise fatal) should affect anything. Is there a way to easily reproduce this? Write a tool that spams event log until it crashes, then try to start Jenkins installed as service?

          evernat added a comment -

          I have reproduced this on XP with Jenkins v1.574.
          After changing the properties of application events log to not overwrite (the default is to overwrite only events older than 7 days), the Jenkins service does not want to start and it does not say anything on why.
          There is nothing written in jenkins.wrapper.log, jenkins.out.log or jenkins.err.log when this happens.

          evernat added a comment - I have reproduced this on XP with Jenkins v1.574. After changing the properties of application events log to not overwrite (the default is to overwrite only events older than 7 days), the Jenkins service does not want to start and it does not say anything on why. There is nothing written in jenkins.wrapper.log, jenkins.out.log or jenkins.err.log when this happens.

          Daniel Beck added a comment -

          I'd like to reproduce this on a more recent Windows version so make sure this is still relevant in some way (even if much less likely to occur), is that the same strategy?

          As I'm not regularly using Windows and would need to start a special Windows testing VM I doubt I have enough events to hit that limit (unless it's a real joke). Hence the question how to generate events.

          Daniel Beck added a comment - I'd like to reproduce this on a more recent Windows version so make sure this is still relevant in some way (even if much less likely to occur), is that the same strategy? As I'm not regularly using Windows and would need to start a special Windows testing VM I doubt I have enough events to hit that limit (unless it's a real joke). Hence the question how to generate events.

          evernat added a comment - - edited

          I do not know how to generate windows applications events, but you can set a very low log size and no overwrite in the control panel:
          http://technet.microsoft.com/fr-fr/library/cc722385%28v=ws.10%29.aspx

          or create events:
          http://stackoverflow.com/questions/446691/how-to-create-windows-eventlog-source-from-command-line

          evernat added a comment - - edited I do not know how to generate windows applications events, but you can set a very low log size and no overwrite in the control panel: http://technet.microsoft.com/fr-fr/library/cc722385%28v=ws.10%29.aspx or create events: http://stackoverflow.com/questions/446691/how-to-create-windows-eventlog-source-from-command-line

          Daniel Beck added a comment -

          I reproduced the issue as described on Windows 8.1 generating the ~3000 events necessary for the 1MB log to stop accepting new events, and it caused a Jenkins service restart to fail.

          Opened JENKINS_HOME, ordered files by modification date, and found in jenkins.wrapper.log:

          2014-09-06 16:49:50 - Stop exception
          Message:The event log file is full
          Stacktrace:   at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName)
             at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData)
             at System.Diagnostics.EventLog.WriteEntry(String message)
             at winsw.WrapperService.LogEvent(String message)
             at winsw.WrapperService.StopIt()
             at winsw.WrapperService.OnStop()
          

          Unfortunately it seems this is only added when stopping the service fails, not during the start.

          Daniel Beck added a comment - I reproduced the issue as described on Windows 8.1 generating the ~3000 events necessary for the 1MB log to stop accepting new events, and it caused a Jenkins service restart to fail. Opened JENKINS_HOME, ordered files by modification date, and found in jenkins.wrapper.log : 2014-09-06 16:49:50 - Stop exception Message:The event log file is full Stacktrace: at System.Diagnostics.EventLogInternal.InternalWriteEvent(UInt32 eventID, UInt16 category, EventLogEntryType type, String[] strings, Byte[] rawData, String currentMachineName) at System.Diagnostics.EventLogInternal.WriteEntry(String message, EventLogEntryType type, Int32 eventID, Int16 category, Byte[] rawData) at System.Diagnostics.EventLog.WriteEntry(String message) at winsw.WrapperService.LogEvent(String message) at winsw.WrapperService.StopIt() at winsw.WrapperService.OnStop() Unfortunately it seems this is only added when stopping the service fails, not during the start.
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]

            danielbeck Daniel Beck
            millergarym millergarym
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: