no stoplogging param Rocket.stop() called in Rocket.start()

Bug #707507 reported by Feite Jaarsma
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Rocket Web Server
Fix Committed
Medium
Unassigned

Bug Description

Rocket has a .start() method. When the server is stopped this method will call the .stop() method without parameters. The .stop() method has an optional parameter stoplogging which is set to True by default.
If rocket is stopped it wil therefore shutdown logging by default.

The documentation says about the .stop() method:
stop(stoplogging=True) - This method will:
•timeout and close all active connections
•stop all worker and monitor threads
•if the stoplogging parameter is set to False, all logging objects will be preserved should the server be restarted.

The effect of calling .stop(stoplogging=False) is that the .start() method will terminate and call the .stop() method again this time without the stoplogging=False parameter.

Possible solutions:
- add stoplogging parameter to .start() method (not prefered)
- make the stoplogging parameter a property of the instance
- pass on the value of stoplogging to the .start() method via a shared variable

Looking at the code a restart will also shutdown logging. The param stoplogging is set to default but the termination of the while not tp.stop_server: loop in .start() will call .stop() without param and shutdown logging. The call to .start() in restart() will start the server again but this time logging will fail. I did not test the restart, but looking at the code the effect will be as written above.

version of Rocket 1.2.3

Revision history for this message
Feite Jaarsma (f-jaarsma) wrote :

Other possible solution: remove the last line of the .start() method
# return self.stop()

Revision history for this message
Tim (tdfarrell) wrote :

Actually I'm thinking of fixing this by removing the whole "stoplogging" thing altogether. I put it there to make sure things were being flushed properly, but in reality, only handlers need to be flushed and Rocket does not add any handlers of its own.

Since the application that uses logging is the one to add handlers, it should be responsible for shutting down logging when appropriate.

This was a library oversight on my part. Thanks for bringing this up though.

Revision history for this message
Tim (tdfarrell) wrote :

Fixed in commit 183.

Changed in rocket:
status: New → Fix Committed
importance: Undecided → Medium
Revision history for this message
Feite Jaarsma (f-jaarsma) wrote : RE: [Bug 707507] Re: no stoplogging param Rocket.stop() called in Rocket.start()
Download full text (3.2 KiB)

Removing it will not give a problem. The logging module registers the shutdown function to run at system exit (atexit module).

-----Oorspronkelijk bericht-----
Van: <email address hidden> [mailto:<email address hidden>] Namens Tim
Verzonden: vrijdag 28 januari 2011 17:46
Aan: <email address hidden>
Onderwerp: [Bug 707507] Re: no stoplogging param Rocket.stop() called in Rocket.start()

Actually I'm thinking of fixing this by removing the whole "stoplogging"
thing altogether. I put it there to make sure things were being flushed properly, but in reality, only handlers need to be flushed and Rocket does not add any handlers of its own.

Since the application that uses logging is the one to add handlers, it should be responsible for shutting down logging when appropriate.

This was a library oversight on my part. Thanks for bringing this up though.

--
You received this bug notification because you are a direct subscriber of the bug.
https://bugs.launchpad.net/bugs/707507

Title:
  no stoplogging param Rocket.stop() called in Rocket.start()

Status in Rocket Web Server:
  New

Bug description:
  Rocket has a .start() method. When the server is stopped this method will call the .stop() method without parameters. The .stop() method has an optional parameter stoplogging which is set to True by default.
  If rocket is stopped it wil therefore shutdown logging by default.

  The documentation says about the .stop() method:
  stop(stoplogging=True) - This method will:
  .timeout and close all active connections
  .stop all worker and monitor threads
  .if the stoplogging parameter is set to False, all logging objects will be preserved should the server be restarted.

  The effect of calling .stop(stoplogging=False) is that the .start()
  method will terminate and call the .stop() method again this time
  without the stoplogging=False parameter.

  Possible solutions:
  - add stoplogging parameter to .start() method (not prefered)
  - make the stoplogging parameter a property of the instance
  - pass on the value of stoplogging to the .start() method via a shared variable

  Looking at the code a restart will also shutdown logging. The param
  stoplogging is set to default but the termination of the while not
  tp.stop_server: loop in .start() will call .stop() without param and
  shutdown logging. The call to .start() in restart() will start the
  server again but this time logging will fail. I did not test the
  restart, but looking at the code the effect will be as written above.

  version of Rocket 1.2.3

To unsubscribe from this bug, go to:
https://bugs.launchpad.net/rocket/+bug/707507/+subscribe

Door InnoTeam per mail verzonden informatie is uitsluitend bestemd voor de geadresseerde. Gebruik van
deze informatie door anderen dan de geadresseerde is niet toegestaan. Indien deze mail u kennelijk
onbedoeld heeft bereikt, verzoeken wij u direct contact met ons op te nemen en de informatie in deze mail
te vernietigen. InnoTeam staat niet in voor de juiste en volledige overbrenging van de inhoud van
verzonden mail of voor tijdige ontvangst ervan. InnoTeam attendeert erop dat de vertrouwelijkheid van
informatie verzonden per mail niet gewaarborgd is...

Read more...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.