Closed colin-scott closed 9 years ago
Here's a minimal example for triggering this behavior:
https://github.com/colin-scott/web-page-replay/blob/master/minimal_wpr_shutdown_example.rb
For future reference: this is too hairy to deal with. My plan is just to copy Telemetry's code.
FYI, for Telemetry, I am considering spawning Web Page Replay using Python's multiprocessing module instead of subprocess. However, this is low priority.
On Thu, Nov 20, 2014 at 6:54 PM, Colin Scott notifications@github.com wrote:
For future reference: this is too hairy to deal with. My plan is just to copy Telemetry's code https://code.google.com/p/chromium/codesearch#chromium/src/tools/telemetry/telemetry/core/webpagereplay.py&q=web%20page%20replay%20%20file:%20telemetry&sq=package:chromium&type=cs .
— Reply to this email directly or view it on GitHub https://github.com/chromium/web-page-replay/issues/35#issuecomment-63917621 .
As a reference, I added a few lines to replay.py to allow the signal interrupt to be handled properly. I derived the code from a few other examples. This allowed child processes to be shutdown gracefully and the wpr file to be written out.
import signal import sys
def signal_term_handler(signal, frame): print 'got SIGINT' logging.info('Shutting down.') if options.record: http_archive.Persist(replay_filename) logging.info('Saved %d responses to %s', len(http_archive), replay_filename) sys.exit(0)
signal.signal(signal.SIGINT, signal_term_handler)
Hey,
I'm writing a script to programmatically start and then shutdown web-page-replay.
I'm having difficulty properly shutting down web-page-replay. In particular, when I:
it appears that web-page-replay subprocess does not exit properly. As a result, /etc/resolv.conf is still set to 127.0.0.1.
Calling wait() should, in theory, clean up all of web-page-replay's children. But, apparently this isn't happening?
I also tried sending SIGTERM to web-page-replay's process group, but this didn't work either.
What's the proper way to shutdown a web-page-replay subprocess?
Thanks! -Colin