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

Updating fails - Database removal generates EBUSY on Windows #270

Closed
UziTech opened this issue Jan 5, 2017 · 5 comments
Closed

Updating fails - Database removal generates EBUSY on Windows #270

UziTech opened this issue Jan 5, 2017 · 5 comments
Labels
Milestone

Comments

@UziTech
Copy link
Contributor

UziTech commented Jan 5, 2017

when trying to update php-integrator-base it fails with the error

EBUSY: resource busy or locked, unlink 'C:\Users\tjbrix\.atom\packages\php-integrator-base\indexes\Vic.sqlite-wal

The only way to get it to work is to uninstall php-integrator-base, restart atom then reinstall php-integrator-base

@dipyalov
Copy link
Contributor

dipyalov commented Jan 5, 2017

I confirm. This happens constantly on windows.

@Gert-dev Gert-dev added the bug label Jan 6, 2017
@nahuelhds
Copy link

nahuelhds commented Jan 11, 2017

This happens every time I've update it. Then I have to remove ALL the packages and re-install them. Quite annoying haha

Windows 10 64bits

@Gert-dev Gert-dev changed the title updating fails Updating fails - Database removal generates EBUSY on Windows Jan 22, 2017
@nahuelhds
Copy link

Any news about this? I'd be nice to be able to update without having to uninstall every time. =)

@Gert-dev
Copy link
Owner

Not yet, but I do have an idea as to why this happens. It is likely the IntiializeCommand in the core that is trying to unlink the database and reinitialize it on startup. It does ensure that the connection is closed before doing that, but the base package kills the old core when shutting down, so the connection likely lingers for a moment and thus generates the busy error. In other words:

  • User updates base package.
  • Atom deactivates old version of base package down (calls deactivate, which in turn kills the core). Core has no opportunity to close its active connection.
  • Atom completes update by replacing base package files.
  • Atom activates new version of base package.
  • New version of base package downloads the core and starts it.
  • Base package tests if project database is outdated, if so, spawns an initialize command.
  • Initialize command from core attemps to unlink database to create a new one and fails, because an old connection is still active.

Of course, I haven't actually verified this yet, but this is what I think is happening. A solution would be to not kill the PHP server on deactivation, but rather send a request to ask it to shutdown nicely, then the core could close the connection and exit itself.

@Gert-dev
Copy link
Owner

The next version is going to include a proper shutdown via a new core exit request, which should fix the issue I mentioned in my last post.

I'm not sure if this will fix all of these kinds of issues, but it should improve the situation in any case.

This will likely be autoclosed after the next version is released, so feel free to create a new ticket if it occurs again afterwards.

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

No branches or pull requests

4 participants