Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After waking up computer from Sleep, Macvim will try to close #1459

Open
2 of 7 tasks
R0GG opened this issue Nov 17, 2023 · 13 comments
Open
2 of 7 tasks

After waking up computer from Sleep, Macvim will try to close #1459

R0GG opened this issue Nov 17, 2023 · 13 comments

Comments

@R0GG
Copy link

R0GG commented Nov 17, 2023

Steps to reproduce

Open a file with MacVim
Lock computer and wait 5-10min
Unlock computer
Macvim will be either closed or a popup will appear to confirm if you want to close MacVim with unsaved buffers.

Expected behaviour

I expect MacVim to no close itself.

This only happen with MacVim hence I think it is an issue with MacVim...
I've tried to look at debug logs but I don't see anything useful.

Maybe you guys have an idea how to trace back the event that was sent to MacVim ?

Version of Vim and architecture

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Sep 12 2023 09:31:27) macOS version - x86_64 Included patches: 1-1897 Compiled by GitHub Actions

MacVim r178 (Vim 9.0.1897)

Environment

MacOs Sonoma 14.1.1 (23B81)
Iterm

How MacVim was installed

Downloaded last release via Github

Logs and stack traces

No response

Vim configuration where issue is reproducable

No response

Issue has been tested with given configuration

  • by running MacVim.app from GUI macOS interface
  • by running vim/gvim/etc installed by MacVim
  • by running other versions of vim (e.g. /usr/bin/vim)

Issue has been tested with no configuration

  • by running mvim --clean (or gvim, supplied by MacVim distribution)
  • by running vim --clean (in terminal, supplied by MacVim distribution)
  • by running vim --clean (in terminal, other suppliers, e.g. /usr/bin/vim)

Other conditions

  • The both Homebrew packages "vim" and "macvim" are installed
@ychin
Copy link
Member

ychin commented Nov 18, 2023

That's weird. Never had that happen to me before. What kind of computer do you have (MacBook, Mac Mini, Apple Silicon versus Intel, year of your model, etc)? Do you have any apps installed that could interfere with keyboard / etc (e.g. BetterTouchTool)? Do you have any externally connected devices?

The popup seems to indicate something actually caused MacVim to be closed rather than a crash. I'm imagining when this happens, you have no unsaved files? (Since unsaved files should have caused a popup)

Do it happen every time? Or sporadically?

Any plugins you are using?

Trace back events… Hmm, if debug logs don't prove useful, I'm not sure. This may need some research. It should be possible in theory. I would like to make sure I understand the nature of the issue first though (per my above questions).

@R0GG
Copy link
Author

R0GG commented Nov 18, 2023

Hi Ychin,
Thank you very much for the quick response!

What kind of computer do you have (MacBook, Mac Mini, Apple Silicon versus Intel, year of your model, etc)?

I have a 2020 MacBook using Intel.

Do you have any apps installed that could interfere with keyboard / etc (e.g. BetterTouchTool)?

I do. I use hammerspoon hmmm
https://github.com/Hammerspoon/hammerspoon

Do you have any externally connected devices?

It happens without any externally connected devices.

Do it happen every time? Or sporadically?

It happens everytime.

@R0GG
Copy link
Author

R0GG commented Nov 18, 2023

I forgot to add the logs... my bad.

for macvim-clean-logs, I started mvim with --clean and waited 10min after locking the computer at 10:34.
for macvim-logs, I started mvim with its usual config and waited 10min after locking the computer at 10:15.

macvim-clean-logs.txt
macvim-logs.txt

@R0GG
Copy link
Author

R0GG commented Nov 18, 2023

After a bit more troubleshooting, it seems to happen only when the MacVim window is hidden.

To reproduce:

  • hide MacVim with cmd + h
  • lock computer
  • wait 5-10mini
  • unlock computer
  • macvim will either be closed or their will be the popup to close MacVim if their are any unsaved files.

@ychin
Copy link
Member

ychin commented Nov 29, 2023

How much memory do you have on your Mac? Do you tend to run up against memory pressure? I think this is due to Sudden Termination which I was surprised to see that MacVim isn't turning off for itself, but I just want to make sure that's the case.

@R0GG
Copy link
Author

R0GG commented Dec 4, 2023

Sorry for the delayed answser @ychin
I have a 32GB laptop. Most of the time i'm at 50% usage.

@ychin
Copy link
Member

ychin commented Dec 8, 2023

I have been looking at this and I can't reproduce it. From what I can gather, macOS just decides to terminate MacVim. There is a feature called Automatic Termination but MacVim isn't using it so we shouldn't be randomly killed like that.

One blog post I found did suggest that this may happen if you are low on disk space, macOS will start purging cache files and somehow that will also kill hidden apps (with no way of configuring it). Would you happen to be low on storage space?

Other than that I can only imagine that Hammerspoon is having a bad interaction with MacVim here. You could try disabling it to see if it still happens.

@ronen
Copy link

ronen commented Mar 7, 2024

The same thing has started happening to me in the past week or so.

@R0GG did you ever track it down? Did it ever stop?

(I'm not low on disk space and I don't use Hammerspoon, so neither of those would be the cause for me.)

@serban
Copy link

serban commented Mar 7, 2024

Key Value
MacVim r178 · r179
macOS 13.6.4 Ventura
Machine 2020 M1 MacBook Pro
Memory 16 GiB
Free Disk Space 1 TB

I have been experiencing the same thing since at least the beginning of January 2024 on both r178 and r179.

Every time I wake my Mac I see the dialog:

Quit without saving?

There are modified buffers, if you quit now all changes will be lost. Quit anyway?

… or MacVim simply isn't running anymore if all the buffers were saved before my Mac went to sleep.

It happens even after a fresh boot when I have multiple gigabytes of free memory.

If I can help to debug this, please let me know. I run into this issue multiple times a day.

And thanks, @ychin, for all your work on MacVim!

@ychin
Copy link
Member

ychin commented Mar 7, 2024

That's not good. What kind of computer do you have @ronen ? I have not been able to replicate this but I have an M1 Max so it's not apples-to-apples. Let me think about it a little and see if there are better ways to gather the info or push out a pre-release build with the relevant data that we can gather.

@ronen
Copy link

ronen commented Mar 8, 2024

hi @ychin, thanks for looking into it (and for everything MacVim :)

I'm running MacVim r179 (Vim 9.1.0), and here's my sys info:

System Software Overview:

  System Version: macOS 14.3.1 (23D60)
  Kernel Version: Darwin 23.3.0
  Boot Volume: Macintosh HD
  Boot Mode: Normal
  Secure Virtual Memory: Enabled
  System Integrity Protection: Enabled
  Time since boot: 13 days, 10 hours, 38 minutes

Hardware Overview:

  Model Name: MacBook Pro
  Model Identifier: MacBookPro16,1
  Processor Name: 8-Core Intel Core i9
  Processor Speed: 2.4 GHz
  Number of Processors: 1
  Total Number of Cores: 8
  L2 Cache (per Core): 256 KB
  L3 Cache: 16 MB
  Hyper-Threading Technology: Enabled
  Memory: 64 GB
  System Firmware Version: 2020.80.5.0.1 (iBridge: 21.16.3049.0.0,0)
  OS Loader Version: 580~1337
  Activation Lock Status: Enabled

That said, I found this reddit thread from 2 years ago: Mac randomly closing apps when sleeping -- no mention of MacVim but similar behavior for other seemingly random collection of apps including some of Apple's own apps. The only solution offered in that thread is to reinstall the OS.

As it turns out I've got an upgrade to 14.4 waiting on deck, so I'll let that install and see if this behavior then goes away :)

@R0GG
Copy link
Author

R0GG commented Mar 8, 2024

Hi @ronen

I confirm I don't have this issue anymore. It disappeared without me realizing it ...

@R0GG
Copy link
Author

R0GG commented Apr 25, 2024

And the issue is back again ... I'm on a corporate laptop so I wonder if it is caused by security toolings ...
Anyways we can trace this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants