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

[State] Disable WAL when running on WSL #1574

Merged
merged 4 commits into from
Jan 10, 2023
Merged

[State] Disable WAL when running on WSL #1574

merged 4 commits into from
Jan 10, 2023

Conversation

romilbhardwaj
Copy link
Collaborator

@romilbhardwaj romilbhardwaj commented Jan 7, 2023

We enabled write ahead logging for state.db in #1513, but it breaks compatibility for WSL (sqlite3.OperationalError: locking protocol; see wsl issue), particularly when running tests.

This PR puts a check for WSL before enabling WAL on state.db.

Note that this "fix" is a band-aid. We may still see issues when WSL users try to access state.db concurrently from multiple processes.

This PR does not touch WAL for skylet_config.db.

Tested (run the relevant ones):

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix @romilbhardwaj! Could we have a TODO comment to note that the fix may cause the database locked problem on the WSL?

Just tested on mac OS 12.6 with the following:

(sky-dev) ➜  sky-experiment-dev (disable_wal) python                                             ✱
Python 3.8.13 | packaged by conda-forge | (default, Mar 25 2022, 06:05:47) 
[Clang 12.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sky.utils import common_utils
>>> common_utils.is_wsl()
False

Seems working!

Copy link
Member

@concretevitamin concretevitamin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The snippet failed 0 out of 30 times for me on Mac (as expected, as this PR is a no-op for Mac).


def is_wsl() -> bool:
"""Detect if running under WSL"""
return 'microsoft' in platform.uname()[3].lower()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work on my machine:

>>> uname().release
'4.4.0-19041-Microsoft'

sky/utils/common_utils.py Outdated Show resolved Hide resolved
sky/global_user_state.py Show resolved Hide resolved
@romilbhardwaj
Copy link
Collaborator Author

Thanks folks! Merging now

@romilbhardwaj romilbhardwaj merged commit fd16154 into master Jan 10, 2023
@romilbhardwaj romilbhardwaj deleted the disable_wal branch January 10, 2023 19:31
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

Successfully merging this pull request may close these issues.

3 participants