Closed Bug 1274444 Opened 8 years ago Closed 8 years ago

Windows builds hang when sending completion notification

Categories

(Firefox Build System :: General, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

(firefox49 fixed)

VERIFIED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: wgianopoulos, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch my workaround patch (obsolete) — Splinter Review
My windows builds often hang after reporting the number of compiler warnings and before the message about "It took a while ..."
ON a whim I tried disabling attempts to notify on windows builds and it cleared the issue.

I will attach the patch I am using.
Attachment #8754589 - Attachment description: my workarond patch → my workaround patch
But, of course, that does not mean this should not be a bug filed against Gnome 3 or it's default adwaita theme.
(In reply to Bill Gianopoulos [:WG9s] from comment #1)
> But, of course, that does not mean this should not be a bug filed against
> Gnome 3 or it's default adwaita theme.

Ooops comment added to wrong bug sorry.
There should be some way to make this not try to notify, or at least not hang if this is a non-interactive process.
Please this code into e.g. `test.py` and run with `python test.py` and report what happens. Also, is this inside stock MozillaBuild? Or are you using a fancy terminal?

from ctypes import Structure, windll, POINTER, sizeof
from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT
class FLASHWINDOW(Structure):
    _fields_ = [("cbSize", UINT),
                ("hwnd", HANDLE),
                ("dwFlags", DWORD),
                ("uCount", UINT),
                ("dwTimeout", DWORD)]
FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
FLASHW_CAPTION = 0x01
FLASHW_TRAY = 0x02
FLASHW_TIMERNOFG = 0x0C
params = FLASHWINDOW(sizeof(FLASHWINDOW),
                    windll.kernel32.GetConsoleWindow(),
                    FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
FlashWindowEx(params)
Summary: Windows builds initiated by windows scheduler often hang after reporting number of compiler warnings → Windows builds hang when sending completion notification
There is an environment variable to make it not notify (MOZ_NOSPAM).

But the proper fix is probably to look at sys.stdin.isatty() and not notify unless that's true. However, that will also suppress notifications if you e.g. pipe output or not perform invocation from a terminal.
(In reply to Gregory Szorc [:gps] from comment #5)
> There is an environment variable to make it not notify (MOZ_NOSPAM).
> 
> But the proper fix is probably to look at sys.stdin.isatty() and not notify
> unless that's true. However, that will also suppress notifications if you
> e.g. pipe output or not perform invocation from a terminal.

I did not say this was a proper fix was really looking for a more proper fix.
(In reply to Gregory Szorc [:gps] from comment #4)
> Please this code into e.g. `test.py` and run with `python test.py` and
> report what happens. Also, is this inside stock MozillaBuild? Or are you
> using a fancy terminal?
> 
> from ctypes import Structure, windll, POINTER, sizeof
> from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT
> class FLASHWINDOW(Structure):
>     _fields_ = [("cbSize", UINT),
>                 ("hwnd", HANDLE),
>                 ("dwFlags", DWORD),
>                 ("uCount", UINT),
>                 ("dwTimeout", DWORD)]
> FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
> FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
> FLASHW_CAPTION = 0x01
> FLASHW_TRAY = 0x02
> FLASHW_TIMERNOFG = 0x0C
> params = FLASHWINDOW(sizeof(FLASHWINDOW),
>                     windll.kernel32.GetConsoleWindow(),
>                     FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
> FlashWindowEx(params)

This is just a stock build the only thing I do is to make a small modification to the start....bat files in mozilla_build to allow including a shell script to run as a parameter so I can get the builds to work via the windows scheduler.  perhaps I should file a separate bug to get that added to make it a standard feature.
Oh and the failure is not a consistent thing.  i do a 32-bit and 64-bit windows build sometimes they both work most days one or the other does often they both fail i wi=would say it hangs at least 30% of the time.
(In reply to Bill Gianopoulos [:WG9s] from comment #7)
> (In reply to Gregory Szorc [:gps] from comment #4)
> > Please this code into e.g. `test.py` and run with `python test.py` and
> > report what happens. Also, is this inside stock MozillaBuild? Or are you
> > using a fancy terminal?
> > 
> > from ctypes import Structure, windll, POINTER, sizeof
> > from ctypes.wintypes import DWORD, HANDLE, WINFUNCTYPE, BOOL, UINT
> > class FLASHWINDOW(Structure):
> >     _fields_ = [("cbSize", UINT),
> >                 ("hwnd", HANDLE),
> >                 ("dwFlags", DWORD),
> >                 ("uCount", UINT),
> >                 ("dwTimeout", DWORD)]
> > FlashWindowExProto = WINFUNCTYPE(BOOL, POINTER(FLASHWINDOW))
> > FlashWindowEx = FlashWindowExProto(("FlashWindowEx", windll.user32))
> > FLASHW_CAPTION = 0x01
> > FLASHW_TRAY = 0x02
> > FLASHW_TIMERNOFG = 0x0C
> > params = FLASHWINDOW(sizeof(FLASHWINDOW),
> >                     windll.kernel32.GetConsoleWindow(),
> >                     FLASHW_CAPTION | FLASHW_TRAY | FLASHW_TIMERNOFG, 3, 0)
> > FlashWindowEx(params)
> 
> This is just a stock build the only thing I do is to make a small
> modification to the start....bat files in mozilla_build to allow including a
> shell script to run as a parameter so I can get the builds to work via the
> windows scheduler.  perhaps I should file a separate bug to get that added
> to make it a standard feature.

Oh and you have obviously confused my with someone who knows enough about python to understand what you just asked me to try.
(In reply to Gregory Szorc [:gps] from comment #5)
> There is an environment variable to make it not notify (MOZ_NOSPAM).
> 
> But the proper fix is probably to look at sys.stdin.isatty() and not notify
> unless that's true. However, that will also suppress notifications if you
> e.g. pipe output or not perform invocation from a terminal.

but then where was the notify going to display anyway in those other cases?

I have a better patch coming. that perhaps is what we need.
Paste the Python code into a new file - say test.py - then run it with `python test.py` from a MozillaBuild shell. I'm curious if that randomly hangs, throws an exception, etc.
GetConsoleWindow() can return NULL. Previously, we may have passed a NULL
console reference into FlashWindowEx(). On my machine (when running in a
console), passing NULL doesn't seem to cause an error. But since we have
a report of this function hanging, it is quite possible it can cause
hangs in other scenarios. Since a NULL console won't result in any
notification, let's not call FlashWindowEx() when no console is available.

Review commit: https://reviewboard.mozilla.org/r/54338/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/54338/
Attachment #8755022 - Flags: review?(mh+mozilla)
(In reply to Gregory Szorc [:gps] from comment #12)
> Created attachment 8755022 [details]
> MozReview Request: Bug 1274444 - Check for null console before attempting to
> flash it; r?glandium
> 
> GetConsoleWindow() can return NULL. Previously, we may have passed a NULL
> console reference into FlashWindowEx(). On my machine (when running in a
> console), passing NULL doesn't seem to cause an error. But since we have
> a report of this function hanging, it is quite possible it can cause
> hangs in other scenarios. Since a NULL console won't result in any
> notification, let's not call FlashWindowEx() when no console is available.
> 
> Review commit: https://reviewboard.mozilla.org/r/54338/diff/#index_header
> See other reviews: https://reviewboard.mozilla.org/r/54338/

I have changed my automated builds to include this patch I will let you know the results (since I seem to b the only person seeing this issue).
(In reply to Gregory Szorc [:gps] from comment #11)
> Paste the Python code into a new file - say test.py - then run it with
> `python test.py` from a MozillaBuild shell. I'm curious if that randomly
> hangs, throws an exception, etc.

except if i am cutting and pasting and running then I am in a n interactive session where this does not hang.
(In reply to Bill Gianopoulos [:WG9s] from comment #13)
> (In reply to Gregory Szorc [:gps] from comment #12)
> > Created attachment 8755022 [details]
> > MozReview Request: Bug 1274444 - Check for null console before attempting to
> > flash it; r?glandium
> > 
> > GetConsoleWindow() can return NULL. Previously, we may have passed a NULL
> > console reference into FlashWindowEx(). On my machine (when running in a
> > console), passing NULL doesn't seem to cause an error. But since we have
> > a report of this function hanging, it is quite possible it can cause
> > hangs in other scenarios. Since a NULL console won't result in any
> > notification, let's not call FlashWindowEx() when no console is available.
> > 
> > Review commit: https://reviewboard.mozilla.org/r/54338/diff/#index_header
> > See other reviews: https://reviewboard.mozilla.org/r/54338/
> 
> I have changed my automated builds to include this patch I will let you know
> the results (since I seem to b the only person seeing this issue).

So far this seems to fix the issue and looks like the correct fix.  I will report back on Monday at around 10AM eastern time.  would mean 8 successful builds in a row by that time.
Attachment #8754589 - Attachment is obsolete: true
OK.  8 consecutive successful builds.  I would say the patch here corrects the issue.
Comment on attachment 8755022 [details]
MozReview Request: Bug 1274444 - Check for null console before attempting to flash it; r?glandium

https://reviewboard.mozilla.org/r/54338/#review51326
Attachment #8755022 - Flags: review?(mh+mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/29ff5e9de6d7
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
This has gone a couple of weeks without a recurrence of the issue.  Verifying this as fixed.
Status: RESOLVED → VERIFIED
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: