Opened 15 years ago
Closed 15 years ago
#12595 closed defect (bug) (fixed)
import from movable type can timeout and doesn't obey php max_execution_time
Reported by: | stevecrozz | Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Import | Keywords: | movable type, import, has-patch, needs-testing |
Focuses: | Cc: |
Description
When importing entries with large numbers of comments, the import script can timeout. Raising php's max_execution_time in php.ini doesn't help because the execution time is reset to a hardcoded 30 seconds in mt.php ironically to keep the script from timing out. In some cases it has the opposite effect and doesn't allow for larger timeouts to be set without modifying the import script.
I'm attaching a patch that works for me. This patch simply checks to see if max_execution_time has been set and uses its value (if set) to provide to set_time_limit(), otherwise it uses the same hardcoded 30 second limit.
Attachments (1)
Change History (10)
#1
@
15 years ago
- Keywords has-patch needs-testing added
Adding has-patch and needs-testing keywords
#2
@
15 years ago
To quote PHP.net's set_time_limit() page:
When called, set_time_limit() restarts the timeout counter from zero. In other words, if the timeout is the default 30 seconds, and 25 seconds into script execution a call such as set_time_limit(20) is made, the script will run for a total of 45 seconds before timing out.
PHP may be configured to have a hard cutoff limit applied as well i believe, that cannot be extended via set_time_limit();
#3
@
15 years ago
- Resolution set to invalid
- Status changed from new to closed
i'm closing this as invalid due to the function call. What could be useful however, is the importer broke up so that it can handle it over multiple steps. At least one other importer currently does it that way to ensure that memory usage and time used doesnt skyrocket.
#4
@
15 years ago
dd32: you may have misunderstood, the import script already uses this function call, my patch merely makes it so you can use a value other than 30.
#5
@
15 years ago
- Milestone set to Unassigned
Maybe we can just go with set_time_limit(0) and allow the script to be run at the mercy of the server. The Livejournal import currently uses this. It's an import, it's not like people won't expect it will take a while.
The real fix of course would be to have the importer do this in stages.
patch fixing max_execution_time hardcoding in mt.php