Support from Acquia helps fund testing for Drupal Acquia logo

Comments

derekw’s picture

Oh and it's a relatively simple webform with only 11 responses so far.

It does use Select or Other.

.kuma’s picture

Similar issues here; downloads for the most part are failing; when they do download the file is blank.

quicksketch’s picture

I wonder if this is a PHP 5.4 issue? What version of PHP are you using @.kuma?

froboy’s picture

I've seen this a few times too. PHP 5.3.10, Webform 4 beta. Sometimes downloads fail and sometimes they succeed. I can't find any rhyme or reason as to why.

DanChadwick’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Closing as cannot reproduce. Note that there was an issue with IE8, if that helps. Please re-open if you can consistently reproduce this issue.

Exteris’s picture

In our case, disabling the background batch module fixed the problem. See #2405027 for more info.

wstocker’s picture

Version: 7.x-4.0-beta1 » 7.x-4.1
Status: Closed (cannot reproduce) » Active

I am seeing the same thing with my install of Webforms

Webforms module version: 7.x-4.1
PHP 7.0.8 and 5.6.10
Drupal 7.51
MAMP Stack and Pantheon Sites (nginx)

No errors in the console, mysql log, apache log, php log or dblog and when I hit submit to download the results I am redirected back to the homepage.

When I rollback the function webform_results_download_form_submit in webform.report from Webforms 3 I am seeing the download to my browser just fine.
So I assume there is a problem with the batch operation or I am missing something.

I am seeing a file being written to my tmp directory, but with nothing in it.

(This is my first time submitting a comment so sorry if there are any issues with it.)

***Edit: As soon as I added the following code under batch_set($batch) in webform_results_download_form_submit it worked:

$batch =&batch_get();
$batch['progressive'] = FALSE;
batch_process();

Liam Morland’s picture

Does this happen consistently? Does it happen on the latest development version of Webform? Can you provide your code as a patch?

seanB’s picture

I can confirm this happens when you have the background process module installed. The background processes run with a different session, so the batch results are not accessible to the actual user.

We can fix this by saving the batch results in the user object. It's not perfect, but I think it's not that bad. Patch is attached.

Liam Morland’s picture

Is this solution a hack or is this the way background_process is supposed to work? What are the steps to reproduce the problem? Does it happen on the latest development version of Webform?

seanB’s picture

This happens on the latest dev version as well. Just install the background process module and try to download submission as excel or csv. The background process module will handle the batch API tasks in a background process and will have a different session as the actual user trying to download the file. Since you do have access to the user object, saving the batch results there seems to make sense.

Imho it is not a hack just a solution to the way the background process module handles the batch API tasks.

*edit
You need to specifically install the background_batch submodule for this issue. Copied the description below to make it more clear what the module does:

Background Batch
This modules takes over the existing Batch API and runs batch jobs in a background process. This means that if you leave the batch page, the jobs continues, and you can return to the progress indicator later.

Batch jobs are delegated to the service host "background_batch" if defined.

Liam Morland’s picture

Thanks. This looks like a sensible solution. Has anyone else tried this?

chrisroane’s picture

I tried the #11 patch, but it didn't work, but what WendyA posted in #7 worked for me. I created a patch and confirmed this works with the latest stable version of the module. Attached is the patch file.

I'm not 100% sure exactly what this code is doing or why it makes it work, but it does the trick for us. We are using PHP 7.

Liam Morland’s picture

Such a patch would require comment explaining what it is doing and why it helps.

joelpittet’s picture

Version: 7.x-4.1 » 7.x-4.x-dev
Status: Needs review » Reviewed & tested by the community

Works though.

Liam Morland’s picture

Status: Reviewed & tested by the community » Needs work

This needs a comment explaining what it is doing.

Yaremchuk’s picture

As I understand, patch #13 turn off butch and perform the action in a regular way.

amourow’s picture

#13 can resolve the issue as our situation is running on multiple containers with Pantheon and is similar to #7

The batch processes may run in different containers and try to get the tmp file in the batch process before the file gets shared in all containers.
A setting that allows user to turn batch on/off will be helpful for similar situation.

amourow’s picture

Based on #7 and #13. I'd like to add an advance option in webform settings.

amourow’s picture

Status: Needs work » Needs review
hey_germano’s picture

Reviewed #19, code looks good, I just made a few small edits. This version modifies the help text for clarity and adds a variable_del on uninstall for webform_export_progressive_batch.

My understanding (which may be off) is that this patch works because tmp path can vary from one request to another on a load balanced environment. This can result in empty/malformed export files. With the progressive method, each request may hit a different webhead, but the non-progressive option executes the batch in one pass.

sparklingrobots’s picture

Issue tags: +Seattle2019

Tagging for Seattle2019 contribution day.

jenlampton’s picture

Patch in #21 still applies with fuzz to 7.x-4.20.

Liam Morland’s picture

Status: Needs review » Postponed (maintainer needs more info)

Background Batch module has been superseded by background_process module.

Does it still work the same way with background_process? Does the problem only happen when background_process is installed? Does it always happen when background_process is installed? If these are both true, then instead of having the webform_export_progressive_batch variable, it could just use module_exists().

amourow’s picture

In my case, this issue happens without the Background Process module.

jenlampton’s picture

Status: Postponed (maintainer needs more info) » Needs review

I'm in the same boat as @amourow: I do not use Background Batch or Background Process, and still have this issue. Patch in #21 still applies with fuzz to 7.x-4.21.

Liam Morland’s picture

jenlampton’s picture

Status: Needs review » Reviewed & tested by the community

This updated patch still works for me, and for those who need it, it also applies (with some fuzz) to webform 7.x-4.23.

  • Liam Morland committed 41db52d on 7.x-4.x authored by amourow
    Issue #2101643 by Liam Morland, amourow, seanB, hey_germano, chrisroane...
Liam Morland’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone

Liam Morland’s picture

Title: No export file ready for download. » Allow progressive batch export to be disabled

Status: Fixed » Closed (fixed)

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