iSECPartners / yontma

You'll never take me alive.
Other
86 stars 18 forks source link

Double Hibernate #23

Closed tomrittervg closed 11 years ago

tomrittervg commented 11 years ago

Sometimes when resuming from hibernation, the machine will re-hibernate. When I resume again, it will stay booted.

This has happened to me 2 out of 2 times after I had traveled home/to work. I've tried reproducing it consciously, suspecting it to happen if I boot with the power plugged in, or with the power not plugged in but then connected as it was booting - but I've failed to find consistent repo steps. I can say that I consistently hibernate the machine by locking it and then pulling the power.

andreasjunestam commented 11 years ago

Tom, please let us know if you find a way to repro it. It might also help to run the debug build, which produces a debug log. That way we can see why it hibernates.

tomrittervg commented 11 years ago

So, I've got a debug log, but there's no timestamps (see #24) so it doesn't help all that much. It happens somewhere towards the end of this log, and here's me walking backwards from this point in time:

This is my recollection, walking backwards:

I turned on my machine to make this note, about 11PM. It was plugged in when I turned it on. I shut down the machine to go home. It was plugged in when I shut it down @ 4:30ish I plugged in the machine while the screen was not locked when I got back to my desk I found that my laptop had hibernated. When I turned it on, it immediately rehibernated (the double hibernate). It took maybe 10-15 min to find the conference room I thought I left the screen unlocked, then unplugged the power, to walk to a conference room @ 3PM

Here is the entire contents of the log in normal order:

In ServiceMain bNeverLoggedIn = FALSE ServiceMain: Going into main loop In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started PowerMonitorThread: Machine was not connected to AC power at lock time. PowerMonitorThread: Exiting WiredEtherMonitorThread: Firing monitor event WiredEtherMonitorThread: Exiting ServiceMain: Wired ether disconnected -> suspend In ServiceHandlerEx ServiceHandlerEx: Going into suspended state In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started PowerMonitorThread: Machine was not connected to AC power at lock time. PowerMonitorThread: Exiting WiredEtherMonitorThread: Firing monitor event WiredEtherMonitorThread: Exiting ServiceMain: Wired ether disconnected -> suspend In ServiceHandlerEx ServiceHandlerEx: Going into suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started PowerMonitorThread: Machine was not connected to AC power at lock time. PowerMonitorThread: Exiting WiredEtherMonitorThread: Started In ServiceHandlerEx In ServiceHandlerEx WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx ServiceHandlerEx: Firing service end event WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting ServiceMain: Service stopped ServiceMain: Exiting In ServiceMain bNeverLoggedIn = TRUE ServiceMain: Going into main loop In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx ServiceHandlerEx: Firing service end event WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting ServiceMain: Service stopped ServiceMain: Exiting In ServiceMain bNeverLoggedIn = TRUE ServiceMain: Going into main loop In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx WiredEtherMonitorThread: Started PowerMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx WiredEtherMonitorThread: Started PowerMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx WiredEtherMonitorThread: Started PowerMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Firing monitor event PowerMonitorThread: Exiting ServiceMain: AC disconnected -> suspend In ServiceHandlerEx ServiceHandlerEx: Going into suspended state In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started PowerMonitorThread: Machine was not connected to AC power at lock time. PowerMonitorThread: Exiting In ServiceHandlerEx ServiceHandlerEx: Firing service end event WiredEtherMonitorThread: Exiting ServiceMain: Service stopped ServiceMain: Exiting In ServiceMain bNeverLoggedIn = TRUE ServiceMain: Going into main loop In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx WiredEtherMonitorThread: Started PowerMonitorThread: Started In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx WiredEtherMonitorThread: Started PowerMonitorThread: Started In ServiceHandlerEx WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Firing monitor event PowerMonitorThread: Exiting ServiceMain: AC disconnected -> suspend WiredEtherMonitorThread: Firing monitor event WiredEtherMonitorThread: Exiting In ServiceHandlerEx ServiceHandlerEx: Going into suspended state ServiceMain: Wired ether disconnected -> suspend In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Going into suspended state In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx ServiceHandlerEx: Firing service end event WiredEtherMonitorThread: Exiting PowerMonitorThread: Exiting ServiceMain: Service stopped ServiceMain: Exiting In ServiceMain bNeverLoggedIn = TRUE ServiceMain: Going into main loop In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Exiting WiredEtherMonitorThread: Exiting

mlynch-isec commented 11 years ago

It looks like this is the problem:

In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Firing monitor event PowerMonitorThread: Exiting ServiceMain: AC disconnected -> suspend WiredEtherMonitorThread: Firing monitor event WiredEtherMonitorThread: Exiting In ServiceHandlerEx ServiceHandlerEx: Going into suspended state ServiceMain: Wired ether disconnected -> suspend In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Going into suspended state

If both wired Ethernet and AC power are removed at the same time, we don't coalesce them into a single hibernate.

We need to change the YontaService.cpp code so that when one monitoring event fires, we 1) shut down all monitoring threads and 2) reset all monitoring events

andreasjunestam commented 11 years ago

We could replace the two events with a single hibernation event. Still think the sleep and recheck is a good idea to avoid hibernating on glitches.

----- Reply message ----- From: "mlynch-isec" notifications@github.com To: "iSECPartners/yontma" yontma@noreply.github.com Cc: "Andreas Junestam" andreas@isecpartners.com Subject: [yontma] Double Hibernate (#23) Date: Mon, Mar 25, 2013 8:10 am

It looks like this is the problem:

In ServiceHandlerEx PowerMonitorThread: Started WiredEtherMonitorThread: Started In ServiceHandlerEx PowerMonitorThread: Firing monitor event PowerMonitorThread: Exiting ServiceMain: AC disconnected -> suspend WiredEtherMonitorThread: Firing monitor event WiredEtherMonitorThread: Exiting In ServiceHandlerEx ServiceHandlerEx: Going into suspended state ServiceMain: Wired ether disconnected -> suspend In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Resuming from suspended state In ServiceHandlerEx In ServiceHandlerEx In ServiceHandlerEx ServiceHandlerEx: Going into suspended state

If both wired Ethernet and AC power are removed at the same time, we don't coalesce them into a single hibernate.

We need to change the YontaService.cpp code so that when one monitoring event fires, we 1) shut down all monitoring threads and 2) reset all monitoring events

— Reply to this email directly or view it on GitHubhttps://github.com/iSECPartners/yontma/issues/23#issuecomment-15398764.

mlynch-isec commented 11 years ago

We're working on a fix but in the meantime:

Workaround: Do not use YoNTMA as a replacement for manual hibernation if the laptop has both Ethernet and AC plugged in. Manually hibernate the machine before locking + unplugging the laptop.