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

Parse errors within INCLUDEd files leak file handles #5942

Closed
alexbrault opened this issue Dec 4, 2019 · 4 comments
Closed

Parse errors within INCLUDEd files leak file handles #5942

alexbrault opened this issue Dec 4, 2019 · 4 comments
Assignees
Milestone

Comments

@alexbrault
Copy link
Contributor

When the parser encounters an error, it immediately exits its loop, closes the current file and returns. If that happens while parsing a file included with the INCLUDE token, all the other files in the include stack are left open. This is especially a problem in MapScript since those files may not be reclaimed by the operating system until the parent process exits.

For example:
leaked.map:

map
include 'parse_error.map'
end

parse_error.map:

invalid token
dmorissette added a commit that referenced this issue Jan 2, 2020
Support nested SYMBOLSETs without leaking (Fixes #5941 and #5942)
@dmorissette
Copy link
Contributor

Reopening... this is related to #5941, but PR#5944 does not address this, my mistake. The fix will be more involved as it is related to generic handling of INCLUDEs in the parser.

@sdlime, you may be the best candidate to address this one.

@dmorissette dmorissette reopened this Jan 2, 2020
@jmckenna jmckenna added this to the 7.6.1 Release milestone Mar 31, 2020
@jmckenna
Copy link
Member

@sdlime, as @dmorissette said, can you add this onto your plate? I think this one is important.

@sdlime
Copy link
Member

sdlime commented Mar 31, 2020

Yes, will try to find time this week. Update - time has been hard to find, hopefully this weekend.

@sdlime
Copy link
Member

sdlime commented Apr 15, 2020

I have a pull request out there that aims to address this in master but it needs to be verified. @alexbrault, any chance you could take a look? I've tried with parse errors in the main map file, one include deep and two includes deep and the right code seems to be being called.

--Steve

jmckenna added a commit that referenced this issue Jul 21, 2020
Addresses open file handles when parse errors occur in include files  (Issue #5942)
MapServer-backport-bot pushed a commit to MapServer-backport-bot/MapServer that referenced this issue Jul 21, 2020
@jmckenna jmckenna modified the milestones: 7.6.1 Release, 8.0 Release Aug 19, 2020
@sdlime sdlime closed this as completed Apr 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants