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

projectorganizer: Too many open files #604

Closed
kugel- opened this issue Sep 27, 2017 · 13 comments
Closed

projectorganizer: Too many open files #604

kugel- opened this issue Sep 27, 2017 · 13 comments

Comments

@kugel-
Copy link
Member

kugel- commented Sep 27, 2017

Since a recent ubuntu update I get this when starting Geany.

(geany:3522): GLib-ERROR **: Creating pipes for GWakeup: Too many open files

If I disable git-changebar, it does start just fine.

@b4n any idea?

@kugel-
Copy link
Member Author

kugel- commented Sep 27, 2017

@b4n Sorry, git-changebar was an innocent victim.

@techee projectorganizer keeps file descriptors open to lots of directores (my project base directory has many subdiretories). One something tries to open one more file descriptor everything falls down. Why does projectorganizer keep so many fds?

The limit seems to be 1024 on my system, for processes started by my local non-root user. projectorganizer uses more than 1000 of them.

@elextr
Copy link
Member

elextr commented Sep 27, 2017

@kugel- check that you don't have a loop in your filesystem, even a soft link will make it go in a loop.

@elextr
Copy link
Member

elextr commented Sep 27, 2017

@techee I'm thinking this line should check for soft links, or is it intended to follow them? If it is intended to follow links then it should check the realpath of the directory has not been seen before to avoid loops.

@kugel- kugel- changed the title git-changebar: Too many open files projectorganizer: Too many open files Sep 27, 2017
@kugel-
Copy link
Member Author

kugel- commented Sep 27, 2017

I wonder why projectorganizer keeps FDs to all that dirs/files open.

@elextr
Copy link
Member

elextr commented Sep 27, 2017

As it descends the directory tree it opens each directory and as it reads the entries recursively opens each one thats a directory. So as it opens each child directory, each parent directory is still open since it hasn't finished reading the entries in it yet. So if you get a loop in the filesystem it will simply run out of FDs.

@kugel-
Copy link
Member Author

kugel- commented Sep 27, 2017

In the non-crashing case, after Geany finished starting, the file descriptors are still open.

I don't see loops when examining /proc/$(pidof geany)/fd

@elextr
Copy link
Member

elextr commented Sep 27, 2017

In the non-crashing case, after Geany finished starting, the file descriptors are still open.

I don't see any FDs that point to project files after opening.

@kugel-
Copy link
Member Author

kugel- commented Sep 27, 2017

Perhaps the limit is hit during traversal, and the code doesn't clean up properly?

@techee
Copy link
Member

techee commented Sep 27, 2017

I have to check. This shouldn't happen, there's no need to keep the fd's open for the directories - probably something isn't closed properly.

@techee
Copy link
Member

techee commented Sep 27, 2017

@elextr The plugin detects symlink loops and avoids them. It stores all visited paths to a hash table and if the paths start repeating, it stops the recursion.

@elextr
Copy link
Member

elextr commented Sep 28, 2017

@techee but the constructed path gets longer and longer so it won't compare equal, you need to compare realpath()s. Look at what happens in bash if you have the wd in the prompt, as you cd via a symlink the prompt gets longer and longer :)

@techee
Copy link
Member

techee commented Sep 28, 2017

@elextr Have you checked the code? I do exactly that with tm_get_real_path():

https://github.com/geany/geany-plugins/blob/master/projectorganizer/src/prjorg-project.c#L78

And of course I've tested that when implementing it so I'm pretty sure it works alright.

@elextr
Copy link
Member

elextr commented Sep 28, 2017

@techee ok, I see, inside the recursive call and after you have opened it. I would have put the test here but anyway.

@techee techee closed this as completed Oct 3, 2017
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

3 participants