After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 733805 - poll: WAKE_EVENT() reports false negatives on W32
poll: WAKE_EVENT() reports false negatives on W32
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
unspecified
Other All
: Normal normal
: 1.4.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2014-07-27 03:15 UTC by LRN
Modified: 2014-08-11 06:56 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Prevent false-negative from WAKE_EVENT() on W32 (1.71 KB, patch)
2014-07-27 03:15 UTC, LRN
committed Details | Review

Description LRN 2014-07-27 03:15:24 UTC
This happens if a pipeline in gst-launch is interrupted via GstLaunchInterrupt:
(gst-launch-1.0:11904): GStreamer-CRITICAL **: gstsystemclock: write control failed in wakeup_async: 13:Permission denied
(gst-launch-1.0:11904): GStreamer-CRITICAL **: gst_system_clock_remove_wakeup: assertion 'sysclock->priv->wakeup_count > 0' failed

Actually, nothing is failing, just WAKE_EVENT() looking at leaked error value.
Comment 1 LRN 2014-07-27 03:15:27 UTC
Created attachment 281800 [details] [review]
Prevent false-negative from WAKE_EVENT() on W32

SetEvent() seems to not call SetLastError(0) internally, so checking last
error after calling SetEvent() may return the error from an earlier W32 API
call. Fix this by calling SetlastError(0) explicitly.

Currently WAKE_EVENT() code is cramped into a macro and doesn't look to be
entirely correct. Particularly, it does not check the return value of
SetEvent(), only the thread-local W32 error value. It is likely that SetEvent()
actually just returns non-zero value, but the code mistakenly thinks that the
call has failed, because GetLastError() seems to indicate so.
Comment 2 Sebastian Dröge (slomo) 2014-07-28 07:15:01 UTC
It should probably become an inline function or a multi-line macro :) The comma operator is not very nice.


commit b87c55f6ed83e11a483f43d6bc29a9d4a79c786f
Author: Руслан Ижбулатов <lrn1986@gmail.com>
Date:   Sun Jul 27 03:06:16 2014 +0000

    poll: Prevent false-negative from WAKE_EVENT() on W32
    
    SetEvent() seems to not call SetLastError(0) internally, so checking last
    error after calling SetEvent() may return the error from an earlier W32 API
    call. Fix this by calling SetlastError(0) explicitly.
    
    Currently WAKE_EVENT() code is cramped into a macro and doesn't look to be
    entirely correct. Particularly, it does not check the return value of
    SetEvent(), only the thread-local W32 error value. It is likely that SetEvent()
    actually just returns non-zero value, but the code mistakenly thinks that the
    call has failed, because GetLastError() seems to indicate so.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733805