Hi,
I'm using Webform 7.x-4.0-beta3 on a site that's hosted on multiple web servers behind a load-balancer that share a database and files directory, but that have discrete temporary:// directories. When users go to download a file of submissions to a form, it's possible that the temporary export file is created on one server, but the request to download the export file gets routed to one of the other web servers, where it doesn't actually exist in the temporary:// directory.
I'd like to be able to configure the location where Webform writes its temporary export files so I can be sure that location is shared across all of the web servers. I'll be attaching a patch that does this.
Thanks for the webform module!
-G
Comments
Comment #1
gdl commentedHere's the promised patch.
Comment #2
gdl commentedComment #3
quicksketchHmm, I don't think this should need to be an option. Having separate temporary directories will cause more issues than just with Webform. It's common to upload a file to the temp directory on one request and then move it to its final location on the second request. I would suggest configuring your site to use a shared temp directory and have the directory cleaned up of stale files on cron jobs.
Comment #4
gdl commentedI've never run into problems with multiple web front-ends with individual, unshared temporary:// directories, except for the one described here, but I take your point.
Thanks for Webform!
-G
Comment #5
adammaloneI'm going to have to respectfully disagree here. Using the plupload module as a precedent, it allows the temporary directory to be configurable.
It'll be slower overall to share temporary directories over multiple webheads when there is some kind of networked filesystem doing the distribution. It's optimal to keep temporary:// local to each web for fast local transactions with the filesystem on the server.
By utilising shared filesystems for non-ephemeral file storage it allows each web to have access to the same resources (albeit requiring more CPU and time simply because over the fs wrapper). Ideally, we'd want to keep as much of temporary as possible local to each web with selected items shared (webform exports/plupload etc).
Most people won't need this changed, although those on HA infrastructure with >1 web will require this (or they'll have to pin / do something else inefficient). @Quicksketch, if possible can we reconsider this feature request since it'll have next to no effect for existing users yet those on HA infrastructure will reap the benefits by changing one variable.
The patch itself looks sound and I'd be happy to check/RTBC it if it's decided the feature request can continue.
Comment #6
raccer commented@typhonius +1 Great summary!
See https://www.drupal.org/node/1782038
It seems we have a client on Pantheon who's running into this issue. I'm going to have him test this patch and we'll look forward to marking this RTBC.
Comment #7
danchadwick commentedSeems reasonable. I hate the duplication of defaults, but it's probably not worth addressing with cmi in d8. I'd like to see nested function calls tho. I can do it, or a tweaked patch would speed up the commit. :)
Comment #9
danchadwick commentedI tweaked your patch by combining the redundant code into a trivial helper. I also do not variable_del the configuration. It seems to be the webform standard to only variable_del configuration variables that are set with the UI. The assumption is that the others are set in conf.
To set this, put the following in your settings.php:
Committed to 7.x-4.x and 8.x.
Comment #11
alberto56 commentedThis functionality seems to have been removed in #2830992: Create the Webform-8.x-5.x branch and grant @jrockowitz maintainer access so it does not seem to be available in 8.x-5.x.
Comment #12
jrockowitz commentedD8 is a completely new code base. Please create a new ticket to port this feature to D8.
Comment #13
alberto56 commentedFor anyone looking for this in 8.x-5.x, it was introduced in #2980276: Webform assumes the /tmp directory is always the same, but if there are multiple servers, each may have its own /tmp directory and works a bit differently.
Comment #14
dasginganinjaI just wanted to put up a patch here for an old 7.x-3.x instance we had.