libfuse / pyfuse3

Python 3 bindings for libfuse 3 with asynchronous API (Trio compatible)
https://pyfuse3.readthedocs.io/
Other
162 stars 48 forks source link

tmpfs crashes on access to deleted file #53

Closed mwhudson closed 1 year ago

mwhudson commented 2 years ago

Hi,

Apologies for the slightly vague report, but on the current version of ubuntu test_tmpfs fails, and the failure seems to boil down to this:

In one terminal:

ubuntu@autopkgtest:~/pyfuse3$ mkdir /tmp/foo
ubuntu@autopkgtest:~/pyfuse3$ python3 examples/tmpfs.py  /tmp/foo

In another

ubuntu@autopkgtest:/tmp/autopkgtest.llp16Q/build.xqX/real-tree$ touch /tmp/foo/file
ubuntu@autopkgtest:/tmp/autopkgtest.llp16Q/build.xqX/real-tree$ rm /tmp/foo/file
ubuntu@autopkgtest:/tmp/autopkgtest.llp16Q/build.xqX/real-tree$ ls /tmp/foo/file
ls: cannot access '/tmp/foo/file': Transport endpoint is not connected

and going back to the first we see:

Traceback (most recent call last):
  File "/home/ubuntu/pyfuse3/examples/tmpfs.py", line 121, in get_row
    row = next(self.cursor)
StopIteration

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/pyfuse3/examples/tmpfs.py", line 451, in <module>
    trio.run(pyfuse3.main)
  File "/usr/lib/python3/dist-packages/trio/_core/_run.py", line 1932, in run
    raise runner.main_task_outcome.error
  File "/home/ubuntu/pyfuse3/src/_pyfuse3.py", line 43, in wrapper
    await fn(*args, **kwargs)
  File "src/pyfuse3.pyx", line 781, in main
    async with trio.open_nursery() as nursery:
  File "/usr/lib/python3/dist-packages/trio/_core/_run.py", line 815, in __aexit__
    raise combined_error_from_nursery
  File "/home/ubuntu/pyfuse3/src/_pyfuse3.py", line 43, in wrapper
    await fn(*args, **kwargs)
  File "src/internal.pxi", line 272, in _session_loop
    await py_retval
  File "src/handlers.pxi", line 168, in fuse_setattr_async
    entry = <EntryAttributes?> await operations.setattr(c.ino, entry, fields, fh, ctx)
  File "/home/ubuntu/pyfuse3/examples/tmpfs.py", line 315, in setattr
    return await self.getattr(inode)
  File "/home/ubuntu/pyfuse3/examples/tmpfs.py", line 150, in getattr
    row = self.get_row('SELECT * FROM inodes WHERE id=?', (inode,))
  File "/home/ubuntu/pyfuse3/examples/tmpfs.py", line 123, in get_row
    raise NoSuchRowError()
NoSuchRowError: Query produced 0 result rows

This worked a few months ago in Ubuntu so we've probably upgraded some dependency that caused this to break -- any idea which one? :)

Nikratio commented 2 years ago

Thanks for the report, and apologies for the delayed response!

I don't think any change of dependencies could cause this.

However, I notice that it crashes in the call to setattr() - which really should not be called when the only commands you issue are touch, rm and ls.

Is perhaps autopkgtest doing something here behind the scenes?

ThomasWaldmann commented 2 years ago

I worked around this in #56.

See also discussion there: https://github.com/ThomasWaldmann/pyfuse3/issues/2

mwhudson commented 2 years ago

Hmm so this was probably caused by a kernel change? That didn't occur to me but I guess it should have...

ThomasWaldmann commented 1 year ago

Worked around in 3.2.2 release.