[16.0][IMP] fs_storage: invalidate filesystem cache when connection fails#320
Conversation
3707e52 to
302a29a
Compare
302a29a to
91f673f
Compare
91f673f to
3c08fcc
Compare
lmignon
left a comment
There was a problem hiding this comment.
@JordiMForgeFlow Thank you for this improvement. A few comments... In the same time can you add a file named 320.feature into the fs_storage/readme/newsframent with a description of this new feature. The content will be used at merge time to fill the addon's changelog.
Could you also update the USAGE.rst file to describe the new parameters?
3c08fcc to
0d6a88a
Compare
LoisRForgeFlow
left a comment
There was a problem hiding this comment.
LGTM
invalidate_cache_on_error maybe is not even needed as a setting and what it adds should be just the standard behavior, but not a big deal.
20a1f72 to
17fb3c3
Compare
|
@lmignon after trying using The |
36a5624 to
4b50530
Compare
My concern is about the performance cost when the root directory contains hundred of thousand files... To limit the scope of the |
I agree. We should probably create a file on 1st check (eg: |
4b50530 to
c076645
Compare
|
@sebalix can you try by installing it from https://github.com/fsspec/filesystem_spec ? |
|
Regarding connection failure, I replaced the use of the deprecated functions in
Maybe it's not related at all. |
f2ffb04 to
7f810aa
Compare
7f810aa to
1f4c9f0
Compare
1f4c9f0 to
46aab5b
Compare
|
/ocabot merge minor |
|
What a great day to merge this nice PR. Let's do it! |
|
Congratulations, your PR was merged at 916060f. Thanks a lot for contributing to OCA. ❤️ |
| # Use a marker file to limit the scope of the LS command for performance. | ||
| try: | ||
| self._check_connection(self.__fs) | ||
| except Exception as e: |
There was a problem hiding this comment.
After some tests, we are still facing connections issues and the current implementation doesn't cover it: OSError: Socket is closed
This errors arrives only after some time (several hours, workers have a high lifespan here and FS object is never recreated meanwhile).
There was a problem hiding this comment.
@sebalix maybe then we should not store the FS object at all in the slot, and always call to _get_filesystem
There was a problem hiding this comment.
The module can also be used in contexts of heavy traffic between odoo and external filesystems. This is particularly the case when it is used to manage Odoo's default attachment storage. In such circumstances, the cost of the reconnection required each time the fs proxy would be recreated is not negligible. Perhaps it would be a good idea to set up a 'keep-alive' mechanism via a cron running every 'X' minutes...
There was a problem hiding this comment.
There was a problem hiding this comment.
Not sure to understand the cron approach regarding this in-memory object?
But yes, the only fix that is working for us right now is to return a new FS object every time.
There was a problem hiding this comment.
@JordiBForgeFlow thanks for your answer! I checked again.
This PR was not forward ported to 17.0 branch that we were using. Any change to get this done quickly? I will check tomorrow if I can prepare a forward port myself but i am not so familiar with it.
There was a problem hiding this comment.
@john-herholz-dt all FWs were done. You can see it in v17: https://github.com/OCA/storage/blob/17.0/fs_storage/models/fs_storage.py#L149
There was a problem hiding this comment.
@JordiMForgeFlow okay you are right. I was confused because the def _check_connection method looks different but that is maybe due to different PR later.
So this brings me back to: We still have the issue with closed Socket and we have a test connection method selected for all FS Storage entries.
But I will further investigate it. Thanks for helping!
There was a problem hiding this comment.
@john-herholz-dt unfortunately I am not running this in any V17 project, so I cannot assure you that the changes they did in V17 are still handling correctly the issue.
Maybe you could try changing the _check_connection method back to how it is in V16 to see if it works
There was a problem hiding this comment.
@john-herholz-dt you could be interested by #487 In this PR I add the possibility to disable the cache of the fsspec client in odoo since fsspec already manage it's own cache. IMO, the cache into Odoo should be removed into the next version.
@JordiMForgeFlow @john-herholz-dt AFAIK 16, 17 and 18 branches are aligned. I regularly do back and forward ports between branches and every time I merge a PR. (But I'm not infallible...)
Fixes #319
CC @LoisRForgeFlow