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

[17.0] fs_storage: Connection closed after some time #374

Open
Algosse opened this issue May 29, 2024 · 1 comment
Open

[17.0] fs_storage: Connection closed after some time #374

Algosse opened this issue May 29, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Algosse
Copy link

Algosse commented May 29, 2024

Hello!

Module: fs_storage

I think my issue is related to #319, but for V17.

I set up a FTP fs_storage, and it works great except that after some time (can be 10 seconds or a few minutes), it is impossible to communicate with the filesystem
When downloading:
image
When uploading:
image

If I restart my Odoo instance, it works again.

Like #319, I think the file system expires but is not renewed by Odoo.

Here, the filestore is saved in cache by Odoo.
When I remove the ormcache decorator, the filesystem is created every time, and I don't have any problems.

As mentionned in #319 and #320, with heavy traffic, it is not recommended to fetch the filesystem every time. As it is not my case, I will remove the ormcache decorator while looking for a permanent solution.

@Algosse Algosse added the bug Something isn't working label May 29, 2024
@Algosse
Copy link
Author

Algosse commented Jul 11, 2024

I am still looking for a permanent solution, but here is a little update:

I tried to implement the solutions proposed in #320 for V17, but I still had my issue. I was surprised that the _check_connection method was never called. I figured it was because the file system is mostly accessed through the get_fs_by_code method, which is cached by Odoo's ORM.

I noticed that my issues occur when I'm trying to read/write multiple files at once. My hypothesis is that when doing multiple read/write operations simultaneously through the UI (like drag and drop in the chatter), multiple threads access the same file system (the one in the ORM's cache) at the same time, causing Odoo to freeze. Most of the time, I need to restart my Odoo instance. On Odoo SH branches, the shell also froze, and my only solution was to stop the FTP protocol on the remote server, which made Odoo work again.

Additionally, when I tried to remove the ormcache decorator, I found that the __fs attribute seemed to never be really stored. In fact, in the init method of the fs_storage model, the __fs attribute is set to None. This means that in the fs property, __fs is always generated before doing a check_connection.

Finally, my best shot yet is to do the check_connection in ir_attachment._get_fs_storage_for_code, where get_fs_by_code is called. This way, I can clear the cache and call the method again to have a fresh file store.

I am working on a clean PR that will explain in a better way what I did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant