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

oeserverd keeps files open #96

Open
wellenvogel opened this issue Jul 4, 2020 · 1 comment
Open

oeserverd keeps files open #96

wellenvogel opened this issue Jul 4, 2020 · 1 comment

Comments

@wellenvogel
Copy link

wellenvogel commented Jul 4, 2020

When using the plugin with AvNav and larger number of chart files after some time oeserverd will not respond to requests from the plugin any more (Version: 4.2).
In the log you can see something like:
2020/06/10-16:58:02.086-0x71f0a010-INFO-oesenc_pi: oeserverd Check OK...LoopCount: 3
2020/06/10-16:58:02.200-0x71f0a010-INFO-verifySENC E2
2020/06/10-16:58:02.410-0x71f0a010-INFO-verifySENC E2.5
2020/06/10-16:58:02.411-0x71f0a010-INFO-validateUserKey
2020/06/10-16:58:02.411-0x71f0a010-INFO-Current userKey: ***************
2020/06/10-16:58:02.416-0x71f0a010-INFO-validateUserKey E4
2020/06/10-16:58:02.529-0x71f0a010-INFO-verifySENC E2
2020/06/10-16:58:02.739-0x71f0a010-INFO-verifySENC E2.5
2020/06/10-16:58:02.740-0x71f0a010-INFO-
2020/06/10-16:58:02.741-0x71f0a010-INFO- Cannot load SENC file /home/pi/avnav/data/ocharts/charts/*****.oesenc

When doing some strace on oeserverd I can see that it (or it's forked child) tries to open a fifo and will receive EMFILE (Too many open files).
When checking the open files of oeserverd all the chart files that ever have been used are still open.

When trying to investigate in the plugin code there seems to be no hint for oeserverd when to close the chart file.

For the usage within OpenCPN this will potentially only become an issue when running for a long time and opening and closing charts multiple times (so when the number of allowed open charts is small compared to the number of available charts).

Additionally the error handling in the plugin does not react very well in such cases. Normally it should potentially simply restart oeserverd. But even the handling in validate_SENC_server does not solve such kinds of problems - it will just get no reply from oeserverd and start a new one. But as the file limit is user based even the newly started one runs into the same issue.

So at least the error handling should first ensure to stop any running oeserverd that has previously being started.
And finally there should be a solution to let oeserverd close the file when not needed any more.

Within AvNav I currently just kill all oeserverd children and retry - but this takes time due to the internal retries in the plugin.

@stelian42
Copy link

I also hit this, on the initial step of scanning the charts: ulimit -n is 1024 and when it hangs oeserverd has exactly 1024 open files...

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

No branches or pull requests

2 participants