Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When viewing "more stats" link on a number component in a webform with a single submission, I get the following out of memory error message due to an infinite loop:
Fatal error: Allowed memory size of 201326592 bytes exhausted (tried to allocate 20 bytes) in webform/components/number.inc on line 444
Comment | File | Size | Author |
---|---|---|---|
#9 | webform-fix_infinite_loop-1804858-9.patch | 513 bytes | pdrake |
#7 | 1804858-7.patch | 512 bytes | bxtaylor |
#4 | 1804858-4.patch | 436 bytes | bxtaylor |
#2 | Screen Shot 2012-10-08 at 5.49.04 PM.png | 39.16 KB | bxtaylor |
#1 | webform-fix_infinite_loop-1804858-1.patch | 5.06 KB | pdrake |
Comments
Comment #1
pdrake CreditAttribution: pdrake commentedThis patch excludes the standard deviation table if the standard deviation is 0, which solves the infinite loop that causes the memory limit error. The second patch ("no_whitespace") was created by running git diff -w and is not intended to be used, but makes review much easier.
Comment #2
bxtaylor CreditAttribution: bxtaylor commentedI was able to reproduce the bug when only one submission exists. The patch applied cleanly and fixed the memory exhaustion issue.
From what I see, this prevents the distribution table from being printed if there's only one submission.
Comment #3
quicksketchThanks guys. If we're skipping the entire set of processing, could we short-circuit the function call and just use:
I don't normally advocate multiple returns, but in this situation it avoids a lot of indentation and makes the code clearer. Acceptable?
Comment #4
bxtaylor CreditAttribution: bxtaylor commentedWorks for me. Here's a reroll...
Comment #5
pdrake CreditAttribution: pdrake commentedI'm good with just short-circuiting here. It may be worthy of a comment to ensure nobody adds additional analysis rows after the stddev table rows?
Comment #6
pdrake CreditAttribution: pdrake commentedConditional needs proper spacing.
Comment #7
bxtaylor CreditAttribution: bxtaylor commentedRerolled with conditional spacing fix and comment.
Comment #8
pdrake CreditAttribution: pdrake commentedWorks for me.
Comment #9
pdrake CreditAttribution: pdrake commentedOk, I noticed one more spacing problem. This patch resolves that.
Comment #10
bxtaylor CreditAttribution: bxtaylor commentedAh yes...that space on the return line...
Looks good to me, now.
Comment #11
quicksketchThanks guys. Committed (finally)! Added to all 3.x and 4.x branches.