Closed (fixed)
Project:
Grammar Parser
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
23 Apr 2010 at 07:39 UTC
Updated:
15 Aug 2012 at 17:31 UTC
Jump to comment: Most recent file
When used by API module, or Grammar Parser UI - the parser appears to be growing in size as it processes more files. This prevents parsing the full fileset.
| Comment | File | Size | Author |
|---|---|---|---|
| #18 | memory.txt | 508 bytes | matt2000 |
| #12 | gp_screenlog_before.txt | 20.78 KB | rfay |
| #12 | gp_screenlog_after_patch.txt | 23.54 KB | rfay |
| #7 | gp_779528_1.patch | 3.7 KB | solotandem |
| #3 | gp-memory.tgz | 3.41 KB | lyricnz |
Comments
Comment #1
sdboyer commentedsubscribe. yarrrr
Comment #2
solotandem commentedLet me know if this observation holds with the latest code. Late yesterday I committed a change to turn off the debug flag that had accidentally been turned on in one function. My observation is this seems to prevent the unbounded growth in memory usage, although the memory usage is still significant.
Comment #3
lyricnz commentedWell, how much is "significant"? I attempted to parse the D6 codebase, and got 60-second timeout with less than 10% complete. Memory use at that time was ~187 MB. Attached log.txt and memory.log
Comment #4
willmoy commentedI had the same or a similar looking problem the latest. Maxing out 256Mb trying to parse civicrm code base.
<b>Fatal error</b>: Allowed memory size of 268435456 bytes exhausted (tried to allocate 35 bytes) in <b>/var/www/.../htdocs/sites/default/modules/api/parser.inc</b> on line <b>620</b><br />Line 620 says
$tokens = token_get_all($code);, which is a php function... so I assume this isn't (at least in my case) a grammar parser issueComment #5
lyricnz commentedIt probably IS a garammer parser issue - the actual function that trigged the out-of-memory could be anything, it's only important what used up all the *rest* of the memory, not what "broke the camels back".
Comment #6
willmoy commentedMarked #819928: Out of memory even with 512MB duplicate
Comment #7
solotandem commentedPlease test the attached patch and report your results.
My test results are as follows:
Using the grammar parser ui module to invoke the parsing of the D7 includes and modules directories (in separate passes), the memory usage did not exceed 117.4 million bytes (mB) for the includes directory files and 92.5mB for the modules directory files. The starting memory usage was 19.9mB for the Drupal bootstrap. [The initial memory usage (i.e. to load the parser code but before the parsing begins) is 3.2mB when invoked from the command line without a Drupal bootstrap, thus providing 16mB of cushion.]
The execution time exceeds 60 seconds for the includes file and 120 seconds for the modules files.
Comment #9
duellj commentedTested w/ grammar_parser_ui against the includes/ directory in D7:
w/o patch:
Max memory usage: 197MB
w/ patch:
Max memory usage: 51MB
So the patch definitely helps with memory usage. Still having a problem with timeouts though. I couldn't parse the modules/ directory without it timing out.
An interesting thing happens in the memory log, though: when parsing common.inc, the memory spikes during the build grammar phase, then levels off for the rest of the parsing:
====================
create reader for file ../includes/common.inc
Peak: 20,709,376 bytes
Curr: 20,447,232 bytes
====================
set snippet
Peak: 20,971,520 bytes
Curr: 20,709,376 bytes
====================
unset contents
Peak: 20,971,520 bytes
Curr: 20,709,376 bytes
====================
add token names
Peak: 20,971,520 bytes
Curr: 20,709,376 bytes
====================
build grammar
Peak: 50,331,648 bytes
Curr: 50,331,648 bytes
Comment #10
lyricnz commentedThe timeout is probably a separate (but related) issue: processing of grammars (via Grammar Parser UI, or API module) could be using the Batch API, so that it can parse arbitrary sized filesets.
#784934: Use batch/queue API to allow processing unlimited sized projects
Comment #11
rfay#7: gp_779528_1.patch queued for re-testing.
Comment #12
rfayWow, a very impressive improvement.
I loaded up API module with grammar_parser and then ran cron using
drush -d cron
which reports the ongoing memory usage after each job. The results, before and after, are attached. But before the patch, each API job in the queue added one or two or as much as 40MB to usage. After the patch, each job in the API queue, resulting in a memory-limit fatal on my machine (set to memory_limit=512M) at simpletest.module, with 506MB allocated.
With the patch applied, memory usage still grows gradually, but it's like a 500K per job. The entire cron run succeeds.
Note that there is still a memory leak somewhere, as you can see it steadily climb.
Note also that the peak memory usage of 142MB is certainly higher than we'd hope for this.
But this is such a massive improvement in memory usage that it's definitely a +1 from me.
Comment #13
lyricnz commentedYes, significantly reduced the memory requirement for me also - parsing full D6.17 code base. Seems like RTBC from here.
Comment #14
solotandem commentedCommitted in next dev release. Thanks to everyone who reported test results.
Comment #16
drecute commentedStill experiencing Out of memory even with 1 million bytes
I am using 7.x.1.x-dev of grammar parser. I have also applied the patch just to satisfy my curiosity.
Comment #17
solotandem commentedThree questions:
- what are you parsing? Can you attach the memory.txt file?
- how are you invoking the parsing? (what other modules are involved, e.g. grammar_parser_ui or coder_upgrade?)
- what is the date of the dev version you are using?
Comment #18
matt2000 commentedI'm running into this too, even at 700M memory limit.
My memory.txt is attached. I get the problem with both API module & gpui module. I'm using the dev version of grammar_parser from 2011-May-06 and the 1.0 release of grammar_parser_ui, both patched for Drupal 6.
Please contact me privately if you'd like a copy of the last file attempted. I can't post it publicly, but can share confidentially.
Comment #19
solotandem commentedMarking fixed as Matt's issue is not with Drupal 6 code, but a custom module.
Comment #20
rfayOh dear, I still have this just with API module. I don't have an unlimited amount of memory to use on the server, and it's burning through the 256+ that I've given to php-cli.
I
Comment #21
solotandem commentedIs this a duplicate of #1383890: Parser fails in D8 (Symfony) code? Are you trying to parse code that has namespace constructs?
Comment #22
rfayIt's D6 with API module... so I doubt it.
Comment #23
solotandem commentedSo, are you saying it won't parse the code in the API module itself? If not, please be specific (or contact me in IRC with details).
Comment #24
rfayIt was trying to build an API site. It failed due to memory #fail, as this issue has. I ended up building the whole thing on another server so that it would have a GB or so to work with, then moved the database back. Sad panda.
Comment #25
solotandem commentedSo, again, if you are "trying to build an API site," then the issue is with what you are attempting to parse. Any chance you could provide some details on the latter?
Comment #26
rfayThe very basic API site that's trying to be indexed is in http://dl.dropbox.com/u/7350603/tmp/indexed_files.tgz
Comment #27
solotandem commentedThe dropbox files no longer exist. If you can provide another sample of files that hits the memory limit, then reference the same and reopen this.
Comment #28
solotandem commentedAs no concrete evidence has been submitted, changing status.
If trying to parse code with namespace and use syntax, please try the new 7.x-2.x branch. Parsing should be successful. However, functions used by other projects (API, Coder Upgrade) to interface with the parser have not been updated for structural changes in the grammar storage. See #1708334: Update functions used by other projects to interface with the parser. Also, the grammar_parser_lib make file has not been updated to grab the 2.x branch from this project.