diff mbox

[ovs-dev,RFC] daemon-windows: Set default error mode for services

Message ID 20170825174818.3552-1-aserdean@ovn.org
State Accepted
Headers show

Commit Message

Alin-Gabriel Serdean Aug. 25, 2017, 5:48 p.m. UTC
Microsoft allows default process memory dumps via WER (Windows Error
Reporting).
WER can be set to collect dumps using in general using:
https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx
If a normal application crashes, the user will receive a pop-up dialog,
in which he will be asked of his consent on what will be the steps
after the dump was created (debug, close or send the dump to MSFT).
We disable the dump creation via WER in:
https://github.com/openvswitch/ovs/blob/master/lib/util.c#L492
because the idea is we don't want a pop-up if a OVS process (eg. ovs-vsctl)
has crashed.
(more information on the subject:
https://blogs.msdn.microsoft.com/oldnewthing/20040727-00/?p=38323)

Until we implement our own dump collection mechanism, we can set the default
error mode for services because there are no pop-ups allowed in that case.

Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
Requested-by: Anand Kumar <kumaranand@vmware.com>
---
 lib/daemon-windows.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Anand Kumar Aug. 25, 2017, 11:21 p.m. UTC | #1
Thanks for the patch. 

Acked-by: Anand Kumar <kumaranand@vmware.com>

Regards,
Anand Kumar

On 8/25/17, 10:48 AM, "ovs-dev-bounces@openvswitch.org on behalf of Alin Gabriel Serdean" <ovs-dev-bounces@openvswitch.org on behalf of aserdean@ovn.org> wrote:

    Microsoft allows default process memory dumps via WER (Windows Error
    Reporting).
    WER can be set to collect dumps using in general using:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__msdn.microsoft.com_en-2Dus_library_windows_desktop_bb787181-28v-3Dvs.85-29.aspx&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_W7YUs58&s=0OQvKfDEugpenlU5dZ80JElhDzBjd6Xys9JGa1K5lmw&e= 
    If a normal application crashes, the user will receive a pop-up dialog,
    in which he will be asked of his consent on what will be the steps
    after the dump was created (debug, close or send the dump to MSFT).
    We disable the dump creation via WER in:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_openvswitch_ovs_blob_master_lib_util.c-23L492&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_W7YUs58&s=0-3zOm3jVe_9clvGkQRY-o0Yag_Jwt_wtH_HBLq2Qdk&e= 
    because the idea is we don't want a pop-up if a OVS process (eg. ovs-vsctl)
    has crashed.
    (more information on the subject:
    https://urldefense.proofpoint.com/v2/url?u=https-3A__blogs.msdn.microsoft.com_oldnewthing_20040727-2D00_-3Fp-3D38323&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_W7YUs58&s=hwo9aq2eCDjXH_ce8gNn3KLpDv6IjFL92fEAzM_rgac&e= )
    
    Until we implement our own dump collection mechanism, we can set the default
    error mode for services because there are no pop-ups allowed in that case.
    
    Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
    Requested-by: Anand Kumar <kumaranand@vmware.com>
    ---
     lib/daemon-windows.c | 6 ++++++
     1 file changed, 6 insertions(+)
    
    diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
    index 1ba714d..2ba62d2 100644
    --- a/lib/daemon-windows.c
    +++ b/lib/daemon-windows.c
    @@ -138,6 +138,12 @@ service_start(int *argcp, char **argvp[])
             *argcp = sargc;
             *argvp = *sargvp;
     
    +        /* Enable default error mode so we can take advantage of WER
    +         * (Windows Error Reporting) crash dumps.
    +         * Being a service it does not allow for WER window pop-up.
    +         * XXX implement our on crash dump collection mechanism. */
    +        SetErrorMode(0);
    +
             return;
         }
     
    -- 
    2.10.2.windows.1
    
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-nAOpE7LIHSPV8uy5-437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_W7YUs58&s=w2X6PPKmfvsGZHK3CFa5CxHXwUSNAUnjEkL0qpJN_b8&e=
Alin-Gabriel Serdean Sept. 4, 2017, 2:09 p.m. UTC | #2
Thanks, applied on master and branch-2.8.

Alin.

> -----Original Message-----
> From: ovs-dev-bounces@openvswitch.org [mailto:ovs-dev-
> bounces@openvswitch.org] On Behalf Of Anand Kumar
> Sent: Saturday, August 26, 2017 2:21 AM
> To: Alin Gabriel Serdean <aserdean@ovn.org>; dev@openvswitch.org
> Subject: Re: [ovs-dev] [RFC PATCH] daemon-windows: Set default error
> mode for services
> 
> Thanks for the patch.
> 
> Acked-by: Anand Kumar <kumaranand@vmware.com>
> 
> Regards,
> Anand Kumar
> 
> On 8/25/17, 10:48 AM, "ovs-dev-bounces@openvswitch.org on behalf of Alin
> Gabriel Serdean" <ovs-dev-bounces@openvswitch.org on behalf of
> aserdean@ovn.org> wrote:
> 
>     Microsoft allows default process memory dumps via WER (Windows Error
>     Reporting).
>     WER can be set to collect dumps using in general using:
>     https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__msdn.microsoft.com_en-2Dus_library_windows_desktop_bb787181-
> 28v-3Dvs.85-29.aspx&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-
> nAOpE7LIHSPV8uy5-
> 437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_
> W7YUs58&s=0OQvKfDEugpenlU5dZ80JElhDzBjd6Xys9JGa1K5lmw&e=
>     If a normal application crashes, the user will receive a pop-up
dialog,
>     in which he will be asked of his consent on what will be the steps
>     after the dump was created (debug, close or send the dump to MSFT).
>     We disable the dump creation via WER in:
>     https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__github.com_openvswitch_ovs_blob_master_lib_util.c-
> 23L492&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-
> nAOpE7LIHSPV8uy5-
> 437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_
> W7YUs58&s=0-3zOm3jVe_9clvGkQRY-o0Yag_Jwt_wtH_HBLq2Qdk&e=
>     because the idea is we don't want a pop-up if a OVS process (eg.
ovs-vsctl)
>     has crashed.
>     (more information on the subject:
>     https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__blogs.msdn.microsoft.com_oldnewthing_20040727-2D00_-3Fp-
> 3D38323&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-
> nAOpE7LIHSPV8uy5-
> 437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_
> W7YUs58&s=hwo9aq2eCDjXH_ce8gNn3KLpDv6IjFL92fEAzM_rgac&e= )
> 
>     Until we implement our own dump collection mechanism, we can set the
> default
>     error mode for services because there are no pop-ups allowed in that
case.
> 
>     Signed-off-by: Alin Gabriel Serdean <aserdean@ovn.org>
>     Requested-by: Anand Kumar <kumaranand@vmware.com>
>     ---
>      lib/daemon-windows.c | 6 ++++++
>      1 file changed, 6 insertions(+)
> 
>     diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
>     index 1ba714d..2ba62d2 100644
>     --- a/lib/daemon-windows.c
>     +++ b/lib/daemon-windows.c
>     @@ -138,6 +138,12 @@ service_start(int *argcp, char **argvp[])
>              *argcp = sargc;
>              *argvp = *sargvp;
> 
>     +        /* Enable default error mode so we can take advantage of WER
>     +         * (Windows Error Reporting) crash dumps.
>     +         * Being a service it does not allow for WER window pop-up.
>     +         * XXX implement our on crash dump collection mechanism. */
>     +        SetErrorMode(0);
>     +
>              return;
>          }
> 
>     --
>     2.10.2.windows.1
> 
>     _______________________________________________
>     dev mailing list
>     dev@openvswitch.org
>     https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__mail.openvswitch.org_mailman_listinfo_ovs-
> 2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=Q5z9tBe-
> nAOpE7LIHSPV8uy5-
> 437agMXvkeHHMkR8Us&m=T39QXMGqF3LDTBL68mucqjQoP0yQWcnSJvQ_
> W7YUs58&s=w2X6PPKmfvsGZHK3CFa5CxHXwUSNAUnjEkL0qpJN_b8&e=
> 
> 
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox

Patch

diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c
index 1ba714d..2ba62d2 100644
--- a/lib/daemon-windows.c
+++ b/lib/daemon-windows.c
@@ -138,6 +138,12 @@  service_start(int *argcp, char **argvp[])
         *argcp = sargc;
         *argvp = *sargvp;
 
+        /* Enable default error mode so we can take advantage of WER
+         * (Windows Error Reporting) crash dumps.
+         * Being a service it does not allow for WER window pop-up.
+         * XXX implement our on crash dump collection mechanism. */
+        SetErrorMode(0);
+
         return;
     }