{"action":"created","issue":{"url":"https://api.github.com/repos/tmux/tmux/issues/231","labels_url":"https://api.github.com/repos/tmux/tmux/issues/231/labels{/name}","comments_url":"https://api.github.com/repos/tmux/tmux/issues/231/comments","events_url":"https://api.github.com/repos/tmux/tmux/issues/231/events","html_url":"https://github.com/tmux/tmux/issues/231","id":121185895,"number":231,"title":"tmux [server exited] coming out of sleep on OSX","user":{"login":"phiche","id":5618563,"avatar_url":"https://avatars.githubusercontent.com/u/5618563?v=3","gravatar_id":"","url":"https://api.github.com/users/phiche","html_url":"https://github.com/phiche","followers_url":"https://api.github.com/users/phiche/followers","following_url":"https://api.github.com/users/phiche/following{/other_user}","gists_url":"https://api.github.com/users/phiche/gists{/gist_id}","starred_url":"https://api.github.com/users/phiche/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phiche/subscriptions","organizations_url":"https://api.github.com/users/phiche/orgs","repos_url":"https://api.github.com/users/phiche/repos","events_url":"https://api.github.com/users/phiche/events{/privacy}","received_events_url":"https://api.github.com/users/phiche/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-12-09T08:26:23Z","updated_at":"2015-12-11T16:53:29Z","closed_at":"2015-12-09T08:59:42Z","body":"My first experience of this issue was documented here https://github.com/tmux/tmux/issues/189 \r\n\r\nSince that issue is closed I wanted to track this issue properly. \r\n\r\n**Environment**\r\nI'm using OSX 10.10.5 (MacBook Pro Retina, 15-inch, Late 2013), tmux 2.1, zsh with oh-my-zsh in iTerm2. \r\n\r\nHere is my .tmux.conf\r\n\r\n```\r\nunbind C-b\r\nset -g prefix C-a\r\n\r\n# 256 colors for vim\r\nset -g default-terminal \"screen-256color\"\r\n\r\n# Start window numbering at 1\r\nset-option -g base-index 1\r\nset-window-option -g pane-base-index 1\r\n\r\n# resize pane with arrow keys after pressing prefix\r\n# -r: can be repeated without pressing prefix again\r\n#     (500ms after last '-r' action or prefix)\r\nunbind Left\r\nunbind Right\r\nunbind Down\r\nunbind Up\r\nbind -r h resize-pane -L 2\r\nbind -r l resize-pane -R 2\r\nbind -r j resize-pane -D 2\r\nbind -r k resize-pane -U 2\r\n\r\n# smart pane switching with awareness of vim splits\r\nbind -n C-h run \"(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L\"\r\nbind -n C-j run \"(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D\"\r\nbind -n C-k run \"(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U\"\r\nbind -n C-l run \"(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R\"\r\nbind -n C-\\ run \"(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\\\') || tmux select-pane -l\"\r\n\r\n# Use vim keybindings in copy mode\r\nsetw -g mode-keys vi\r\nset-window-option -g mode-keys vi\r\n\r\n# add powerline\r\nsource /usr/local/lib/python2.7/site-packages/powerline/bindings/tmux/powerline.conf\r\n\r\n# Sane scrolling\r\nset -ga terminal-overrides 'xterm*:smcup@:rmcup@'\r\n\r\n# reload tmux config\r\nbind-key r source-file ~/.tmux.conf\r\n\r\n# allow scrolling with mouse in tmux\r\nset -g mouse on\r\nset -g @scroll-speed-num-lines-per-scroll \"1\"\r\n\r\n# allow copy text by highlighting with v and yanking with y\r\nbind-key -t vi-copy 'v' begin-selection\r\nbind-key -t vi-copy 'y' copy-pipe \"pbcopy\"\r\n\r\n# prefix i to copy mode\r\nunbind [\r\nbind-key -c i copy-mode\r\n\r\n# List of plugins\r\nset -g @plugin 'tmux-plugins/tpm'\r\nset -g @plugin 'tmux-plugins/tmux-resurrect'\r\nset -g @plugin 'tmux-plugins/tmux-continuum'\r\nset -g @plugin 'nhdaly/tmux-scroll-copy-mode'\r\n\r\n# restore tmux session on server start\r\nset -g @continuum-restore 'on'\r\n\r\n# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)\r\n# Install new plugin with prefix I\r\nrun '~/.tmux/plugins/tpm/tpm'\r\n```\r\n\r\n**Description**\r\ntmux randomly exits when my laptop resumes from sleep. Here is what was on my prompt this morning:\r\n```\r\n10:33:39 ~  » tmux                                                                                                                                                          \r\n[server exited]\r\n7:44:16 ~  »\r\n```\r\nThe 10:33:39 timestamp was from yesterday morning, last time I ran tmux.\r\n7:44:16 was this morning when my laptop resumed from sleep.\r\n\r\n**Means to reproduce**\r\nSo far, I have never seen the exit occur when my computer is at my desk, plugged into power when I manually put the computer to sleep from hitting ctrl-shift-power.\r\n\r\nI have only seen the problem occur after I've disconnected from power and the computer has been left sleeping for some hours before resuming.\r\n\r\nThis problem occurs around, I guess, around 25%-33%  of the time resuming from sleep. It feels like it happens are around every 2nd or 3rd day. \r\n\r\n**Additional information**\r\nThis article give a bit more information about sleep mode. \r\nhttps://support.apple.com/en-us/HT201714\r\nUnfortunately it doesn't really indicate what sleep state the CPU might be going into.\r\n\r\nI'm also using vim with a bunch of plugins. Vim was open each time in at least one window during every tmux exit.\r\n\r\nHere is the grep from my system.log\r\n```\r\n9:06:52 ~  » grep '7:44' /var/log/system.log                                                                                                                                \r\nDec  9 07:44:13 Laptop kernel[0]: vm_compressor_record_warmup (28566 - 37807)\r\nDec  9 07:44:15 Laptop kernel[0]: vm_compressor_flush - starting\r\nDec  9 07:44:15 Laptop kernel[0]: vm_compressor_flush completed - took 39185 msecs\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_flush_memory: buffer_cache_gc freed up 8178 wired pages\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_alloc_pages act 152426, inact 587968, anon 208141, throt 0, spec 4087, wire 427937, wireinit 149476\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_setup(0) took 46125 ms\r\nDec  9 07:44:15 Laptop kernel[0]: IO80211AWDLPeerManager::doDisable   source [handleSIOCSIFFLAGS]\r\nDec  9 07:44:15 Laptop kernel[0]: en0: BSSID changed to f0:99:bf:0a:54:03\r\nDec  9 07:44:15 Laptop kernel[0]: en0: channel changed to 36,80\r\nDec  9 07:44:15 Laptop kernel[0]: AirPort: Link Down on awdl0. Reason 1 (Unspecified).\r\nDec  9 07:44:15 Laptop kernel[0]: IO80211AWDLPeerManager::doDisable   source [setLinkState]\r\nDec  9 07:44:15 Laptop kernel[0]: ARPT: 36387.309324: wl0: leaveModulePoweredForOffloads: Wi-Fi will turn off.\r\nDec  9 07:44:15 Laptop kernel[0]: AirPort: Link Down on en0. Reason 8 (Disassociated because station leaving).\r\nDec  9 07:44:15 Laptop kernel[0]: en0::IO80211Interface::postMessage bssid changed\r\nDec  9 07:44:15 Laptop kernel[0]: en0: 802.11d country code set to 'X3'.\r\nDec  9 07:44:15 Laptop kernel[0]: en0: Supported channels 1 2 3 4 5 6 7 8 9 10 11 12 13 36 40 44 48 52 56 60 64 100 104 108 112 116 120 124 128 132 136 140 149 153 157 161\r\nDec  9 07:44:15 Laptop kernel[0]: Bluetooth -- LE is supported - Disable LE meta event\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000340\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_page_list_setall(preflight 0) start 0xffffff83740b7000, 0xffffff8374137000\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_teardown started\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_teardown: wired_pages 428041, free_pages 3690778, active_pages 2799, inactive_pages 38180, speculative_pages 31, cleaned_pages 0, compressor_pages 41\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_teardown_pmap_structs done: last_valid_compact_indx 250601\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_teardown: mark_as_unneeded_pages 4096, 57184, 34885\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_teardown completed - discarded 96165\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_page_list_setall time: 1660 ms\r\nDec  9 07:44:15 Laptop kernel[0]: pages 1054237, wire 308743, act 2799, inact 38179, cleaned 0 spec 31, zf 1, throt 0, compr 41, xpmapped 40000\r\nDec  9 07:44:15 Laptop kernel[0]: did discard act 108962 inact 443522 purgeable 147903 spec 4056 cleaned 0\r\nDec  9 07:44:15 Laptop kernel[0]: WARNING: hibernate_page_list_setall skipped 34210 xpmapped pages\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_page_list_setall found pageCount 349794\r\nDec  9 07:44:15 Laptop kernel[0]: IOHibernatePollerOpen, ml_get_interrupts_enabled 0\r\nDec  9 07:44:15 Laptop kernel[0]: IOHibernatePollerOpen(0)\r\nDec  9 07:44:15 Laptop kernel[0]: encryptStart 14010\r\nDec  9 07:44:15 Laptop kernel[0]: bitmap_size 0x7f508, previewSize 0x6ff7e8, writing 347659 pages @ 0x792d00\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_rebuild started\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_rebuild_pmap_structs done: last_valid_compact_indx 250601\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_rebuild completed - took 88 msecs\r\nDec  9 07:44:15 Laptop kernel[0]: booter start at 944 ms smc 0 ms, [12, 0, 0] total 623 ms, dsply 0, 0 ms, tramp 886 ms\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_machine_init: state 2, image pages 308530, sum was ec02108d, imageSize 0x206de000, image1Size 0x171cb000, conflictCount 3992, nextFree 1042\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_newruntime_map time: 0 ms, IOHibernatePollerOpen(), ml_get_interrupts_enabled 0\r\nDec  9 07:44:15 Laptop kernel[0]: IOHibernatePollerOpen(0) 5 ms\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_machine_init reading\r\nDec  9 07:44:15 Laptop kernel[0]: PMStats: Hibernate read took 227 ms\r\nDec  9 07:44:15 Laptop kernel[0]: hibernate_machine_init pagesDone 349581 sum2 fd99144a, time: 227 ms, disk(0x20000) 671 Mb/s, comp bytes: 64192512 time: 48 ms 1266 Mb/s, crypt bytes: 156315648 time: 37 ms 3943 Mb/s\r\nDec  9 07:44:15 Laptop kernel[0]: Wake reason: EC.LidOpen (User)\r\nDec  9 07:44:15 Laptop kernel[0]: vm_compressor_fastwake_warmup (28566 - 37807) - starting\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000320\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000340\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::wakeEventHandlerThread\r\nDec  9 07:44:15 Laptop kernel[0]: No interval found for . Using 8000000\r\nDec  9 07:44:16 --- last message repeated 3 times ---\r\nDec  9 07:44:15 Laptop kernel[0]: Previous sleep cause: 5\r\nDec  9 07:44:15 Laptop kernel[0]: Previous shutdown cause: 5\r\nDec  9 07:44:15 Laptop kernel[0]: AppleThunderboltNHIType2::prePCIWake - power up complete - took 1 us\r\nDec  9 07:44:15 Laptop kernel[0]: AppleThunderboltGenericHAL::earlyWake - complete - took 15 milliseconds\r\nDec  9 07:44:15 Laptop kernel[0]: com_apple_driver_AppleUSBCardReaderUMC[0xffffff802af91800] - Device termination caused by a wake from hibernation or standby!\r\nDec  9 07:44:15 Laptop kernel[0]: No interval found for . Using 8000000\r\nDec  9 07:44:16 --- last message repeated 7 times ---\r\nDec  9 07:44:15 Laptop kernel[0]: TBT W (2): 0x0040 [x]\r\nDec  9 07:44:15 Laptop kernel[0]: IOThunderboltSwitch<0xffffff802a616c00>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0\r\nDec  9 07:44:15 Laptop kernel[0]: IOThunderboltSwitch<0xffffff802a616c00>(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 12 unplug = 0\r\nDec  9 07:44:15 Laptop kernel[0]: en0: channel changed to 1\r\nDec  9 07:44:15 Laptop kernel[0]: AirPort: Link Up on awdl0\r\nDec  9 07:44:13 Laptop.local watchdogd[392]: [watchdog_daemon] @(         pm_callback) - ref=0x0 msg_type=0xe0000320 msg=0x0\r\nDec  9 07:44:13 Laptop.local configd[51]: [0x7fc4d2614140] [m]DNS query timeout (query time = 36458.007984), [6TE]\r\nDec  9 07:44:13 Laptop.local configd[51]: [0x7fc4d2725f10] [m]DNS query timeout (query time = 36459.593353), [6TE]\r\nDec  9 07:44:13 Laptop.local UserEventAgent[42]: Captive: [CaptiveHandleRedirect:1645] Timed out on en0 (wifi-mofo), assuming online\r\nDec  9 07:44:14 Laptop.local UserEventAgent[42]: Captive: CNPluginHandler en0: Authenticated\r\nDec  9 07:44:15 Laptop kernel[0]: ARPT: 36389.610812: AirPort_Brcm43xx::powerChange: System Wake - Full Wake/ Dark Wake / Maintenance wake\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::systemWakeCall - messageType = 0xE0000340\r\nDec  9 07:44:15 Laptop kernel[0]: AppleCamIn::wakeEventHandlerThread\r\nDec  9 07:44:14 Laptop.local WindowServer[149]: CGXDisplayDidWakeNotification [36389830831659]: posting kCGSDisplayDidWake\r\nDec  9 07:44:14 Laptop.local WindowServer[149]: handle_will_sleep_auth_and_shield_windows: Reordering authw 0x7ff37c1b0920(2000) (lock state: 3)\r\nDec  9 07:44:14 Laptop.local WindowServer[149]: handle_will_sleep_auth_and_shield_windows: err 0x0\r\nDec  9 07:44:16 Laptop.local Karabiner[659]: observer_NSWorkspaceScreensDidWakeNotification\r\nDec  9 07:44:16 Laptop com.apple.xpc.launchd[1] (com.apple.bsd.dirhelper[15463]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.bsd.dirhelper\r\nDec  9 07:44:16 Laptop.local identityservicesd[283]: <IMMacNotificationCenterManager: 0x7f98b2727020>: notification observer: com.apple.iChat   notification: __CFNotification 0x7f98b4b05d80 {name = _NSDoNotDisturbDisabledNotification}\r\nDec  9 07:44:16 Laptop.local imagent[342]: <IMMacNotificationCenterManager: 0x7fa76a61d660>: notification observer: com.apple.FaceTime   notification: __CFNotification 0x7fa76a41a2a0 {name = _NSDoNotDisturbDisabledNotification}\r\nDec  9 07:44:16 Laptop.local identityservicesd[283]: <IMMacNotificationCenterManager: 0x7f98b2727020>:    NC Disabled: NO\r\nDec  9 07:44:16 Laptop.local sharingd[315]: 07:44:16.735 : Discoverable mode changed to Contacts Only\r\nDec  9 07:44:16 Laptop.local sharingd[315]: 07:44:16.736 : BTLE scanning started\r\nDec  9 07:44:16 Laptop.local sharingd[315]: 07:44:16.736 : Scanning mode Contacts Only\r\nDec  9 07:44:16 Laptop.local identityservicesd[283]: <IMMacNotificationCenterManager: 0x7f98b2727020>:   DND Enabled: NO\r\nDec  9 07:44:16 Laptop.local imagent[342]: <IMMacNotificationCenterManager: 0x7fa76a61d660>:    NC Disabled: NO\r\nDec  9 07:44:16 Laptop.local identityservicesd[283]: <IMMacNotificationCenterManager: 0x7f98b2727020>: Updating enabled: YES   (Topics: (\r\nDec  9 07:44:16 Laptop.local sharingd[315]: 07:44:16.744 : BTLE scanner Powered Off\r\nDec  9 07:44:16 Laptop.local imagent[342]: <IMMacNotificationCenterManager: 0x7fa76a61d660>:   DND Enabled: NO\r\nDec  9 07:44:16 Laptop.local imagent[342]: <IMMacNotificationCenterManager: 0x7fa76a61d660>: Updating enabled: YES   (Topics: (\r\nDec  9 07:44:16 Laptop.local dirhelper[15469]: /var/folders/y1/7960pnnn1pvd9pv7qc8487rc0000gn/T/vV7PhHG: walk() error: No such file or directory\r\nDec  9 07:44:17 Laptop kernel[0]: USBMSC Identifier (non-unique): 000000000820 0x5ac 0x8406 0x820, 3\r\n```\r\n\r\nIt looks like running ```tmux -vvvv``` creates some log files:\r\ntmux-client-34820.log\r\ntmux-out-34822.log\r\ntmux-server-34822.log\r\n\r\nIs this the right way to capture the error? \r\n\r\nI'll run like this for a while and get back to you next time it happens.\r\n"},"comment":{"url":"https://api.github.com/repos/tmux/tmux/issues/comments/163988930","html_url":"https://github.com/tmux/tmux/issues/231#issuecomment-163988930","issue_url":"https://api.github.com/repos/tmux/tmux/issues/231","id":163988930,"user":{"login":"noahfrederick","id":151598,"avatar_url":"https://avatars.githubusercontent.com/u/151598?v=3","gravatar_id":"","url":"https://api.github.com/users/noahfrederick","html_url":"https://github.com/noahfrederick","followers_url":"https://api.github.com/users/noahfrederick/followers","following_url":"https://api.github.com/users/noahfrederick/following{/other_user}","gists_url":"https://api.github.com/users/noahfrederick/gists{/gist_id}","starred_url":"https://api.github.com/users/noahfrederick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noahfrederick/subscriptions","organizations_url":"https://api.github.com/users/noahfrederick/orgs","repos_url":"https://api.github.com/users/noahfrederick/repos","events_url":"https://api.github.com/users/noahfrederick/events{/privacy}","received_events_url":"https://api.github.com/users/noahfrederick/received_events","type":"User","site_admin":false},"created_at":"2015-12-11T16:53:28Z","updated_at":"2015-12-11T16:53:28Z","body":"@phiche Please do share your findings."}}