Bug 178402

Summary: REGRESSION (r222709): webkitpy: Hang when workers write to the same stack trace file
Product: WebKit Reporter: Jonathan Bedard <jbedard>
Component: Tools / TestsAssignee: Jonathan Bedard <jbedard>
Status: RESOLVED CONFIGURATION CHANGED    
Severity: Normal CC: aakash_jain, ap, buildbot, commit-queue, dbates, glenn, lforschler, webkit-bug-importer
Priority: P2 Keywords: InRadar, Regression
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=178368
https://bugs.webkit.org/show_bug.cgi?id=176393
Bug Depends on: 176393, 178587    
Bug Blocks:    
Attachments:
Description Flags
Patch none

Description Jonathan Bedard 2017-10-17 11:21:07 PDT
There is a hang when workers write their stack traces to the same file if that file already exists on disk.  This is the root cause of the more general issue addressed in <https://bugs.webkit.org/show_bug.cgi?id=178368>.
Comment 1 Radar WebKit Bug Importer 2017-10-17 11:21:41 PDT
<rdar://problem/35033432>
Comment 2 Jonathan Bedard 2017-10-17 11:22:06 PDT
If we add a pid to the name of the stack-trace, the problem stops.
Comment 3 Jonathan Bedard 2017-10-17 11:45:32 PDT
Created attachment 324035 [details]
Patch
Comment 4 Aakash Jain 2017-10-17 12:14:12 PDT
Comment on attachment 324035 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=324035&action=review

> Tools/Scripts/webkitpy/common/interupt_debugging.py:47
> +        file_name = os.path.join(os.path.dirname(output_file), '{}-{}'.format(os.getpid(), os.path.basename(output_file))) if output_file else None

Is it guaranteed that we won't have file name collision after adding os.getpid() ?
Maybe we can add timestamp in filename instead of pid to make it unique, it would also make it easy to sort these files into the directory having multiple such files.
Comment 5 Jonathan Bedard 2017-10-17 13:02:47 PDT
(In reply to Aakash Jain from comment #4)
> Comment on attachment 324035 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=324035&action=review
> 
> > Tools/Scripts/webkitpy/common/interupt_debugging.py:47
> > +        file_name = os.path.join(os.path.dirname(output_file), '{}-{}'.format(os.getpid(), os.path.basename(output_file))) if output_file else None
> 
> Is it guaranteed that we won't have file name collision after adding
> os.getpid() ?
> Maybe we can add timestamp in filename instead of pid to make it unique, it
> would also make it easy to sort these files into the directory having
> multiple such files.

It's guaranteed that we won't have a file name collision inside a single test run.

Overwriting an existing file with the same name is perfectly fine.  I don't think timestamp is a good way to achieve this because it is possible (likely, in fact) that workers will generate timestamps very close to or even equal to their sibling workers since they will all receive the SIGTERM at the same time.
Comment 6 WebKit Commit Bot 2017-10-17 13:30:21 PDT
Comment on attachment 324035 [details]
Patch

Clearing flags on attachment: 324035

Committed r223572: <https://trac.webkit.org/changeset/223572>
Comment 7 WebKit Commit Bot 2017-10-17 13:30:23 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 WebKit Commit Bot 2017-10-20 09:06:59 PDT
Re-opened since this is blocked by bug 178587
Comment 9 Alexey Proskuryakov 2017-10-20 09:14:28 PDT
This didn't help, at least not enough. Re-fixed by rolling back both r222709 and r223572.
Comment 10 Jonathan Bedard 2017-11-29 10:16:12 PST
Note that this change is now part of the patch up for review in <https://bugs.webkit.org/show_bug.cgi?id=176393>.