... because the batch API stores the whole calling form (ie. the whole test selection form) along with the batch parameters by default. Here is a patch that bypass this behavior.

Comments

damien tournoud’s picture

StatusFileSize
new1.67 KB

Improved version, with more comments.

damien tournoud’s picture

StatusFileSize
new1.71 KB

pwolanin suggested a better wording.

pwolanin’s picture

Status: Needs review » Reviewed & tested by the community

tested. Prevents the WSOD from adding more test classes. Tests still run as expected.

mfer’s picture

As one of the people who experienced this problem I'm glad for this patch. Like pwolanain I tested and verified it works as expected.

@Damien Tournoud thanks for the fix.

damien tournoud’s picture

I confirm that the full suite ran with max_allowed_packet = 1M, flawlessly.

dries’s picture

Status: Reviewed & tested by the community » Needs work

I think we should make the code comments better still. We don't explain why we call batch_process().

pwolanin’s picture

@Dries - did you look at the comments in #2?

dries’s picture

Yes, I don't think they are sufficiently explanatory. In fact, I think the comments in #1 were more specific. Let's take another pass at the comments! :)

pwolanin’s picture

Status: Needs work » Needs review
StatusFileSize
new2.16 KB

ok, here's another try.

dries’s picture

I'm still not sure I understand this patch, and the code comments still don't help me. Sorry. I'll have to start digging the code first so I fully understand this before I can review this properly. Until then, this is a bit fishy.

damien tournoud’s picture

StatusFileSize
new1.88 KB

One last try.

+  // Normally, the forms portion of the batch API takes care of calling
+  // batch_process(), but in the process it saves the whole $form into the
+  // database (which is huge for the test selection form).
+  // By calling batch_process() directly, we skip that behavior and ensure
+  // that we don't exceeding the size of data that can be sent to the database
+  // (max_allowed_packet on MySQL).
mfer’s picture

@Dries - MAMP, xampp, and other setups come with mysql configured to max_allowed_packet = 1M. The simpletest form ($form) has reached a point where it is really really large. Normally, when batch_set() is called in a form submit handler (in this case simpletest_test_form_submit() through simpletest_run_tests()) drupal_process_form() makes sure batch_process() is called. But, before drupal_process_form() executes batch_process() it adds the entire form array to the batch that is stored in the database. In this case the form that is stored in the database causes the $batch to be larger then 1M so an exception is thrown and execution is stopped.

By adding batch_process() in simpletest_run_tests() we set the batch processing into motion without the full simpletest form being added the batch so the form is not stored in the database.

It is a special case for the simpletest form because it is so large.

Does this explanation help?

damien tournoud’s picture

StatusFileSize
new1.88 KB

Heine spotted a grammar error.

mfer’s picture

Status: Needs review » Needs work

We should avoid mysql specific references. This problem could come up in a different database engine. Can this be rephrased in more general terms.

damien tournoud’s picture

Status: Needs work » Needs review

@mfer: please read the patch. It *is* phrased in general terms.

mfer’s picture

Status: Needs review » Needs work
+  // Normally, the forms portion of the batch API takes care of calling
+  // batch_process(), but in the process it saves the whole $form into the
+  // database (which is huge for the test selection form).
+  // By calling batch_process() directly, we skip that behavior and ensure
+  // that we don't exceed the size of data that can be sent to the database
+  // (max_allowed_packet on MySQL).

The last line refers to mysql and a mysql setting. That's not general.

damien tournoud’s picture

Status: Needs work » Needs review

@mfer, thanks for your review... but (1) MySQL is mentioned only in the last line, after a general explanation has been made; and (2) that issue only occurs on MySQL as far as we know.

mfer’s picture

I did some checking. Of the major databases (mysql, postgresql, oracle, mssql) my understanding is that this will only affect mysql.

dries’s picture

Status: Needs review » Fixed

Thanks for clarifying. That helps. I committed the patch to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.