Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix crash when channel is removed but _notify_queue still has events #100

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/fuse_api.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,11 @@ def main(workers=None, handle_signals=True):
on_exit.callback(lambda: restore_signal_handlers())

# Start notification handling thread
_notify_queue_shutdown.clear()
t = threading.Thread(target=_notify_loop)
t.daemon = True
t.start()
on_exit.callback(_notify_queue_shutdown.set)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this in addition to the sentinel object? And if the sentinel method doesn't work, shouldn't we replace it with the Event instead of doing both?

on_exit.callback(_notify_queue.put, None, block=True, timeout=5)

on_exit.callback(lambda: fuse_session_reset(session))
Expand All @@ -313,6 +315,7 @@ def main(workers=None, handle_signals=True):
session_loop_single()
else:
session_loop_mt(workers)
t.join()
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be a good idea to leave a comment here (in the code) on why this is needed, or someone may remove this again at some point as "not needed".


if exc_info:
# Re-raise expression from request handler
Expand Down
3 changes: 3 additions & 0 deletions src/llfuse.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ lock_released = NoLockManager.__new__(NoLockManager)
cdef object _notify_queue
_notify_queue = Queue(maxsize=1000)

cdef object _notify_queue_shutdown
_notify_queue_shutdown = threading.Event()

# Exported for access from Python code
# (in the Cython source, we want ENOATTR to refer
# to the C constant, not a Python object)
Expand Down
6 changes: 5 additions & 1 deletion src/misc.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,11 @@ def _notify_loop():
while True:
req = _notify_queue.get()
if req is None:
return
break
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change has any semantic effect...?


if _notify_queue_shutdown.is_set():
# Just drain the queue
continue
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not break/return?


if req.kind == NOTIFY_INVAL_INODE:
if req.attr_only:
Expand Down