patternlab-php
patternlab-php copied to clipboard
pattern lab processes automatically time out
Hi, Whenever I run the command php core/console --server --with-watch --patternsonly the server will stop after about 10mins and I get the following message in the terminal 'pattern lab processes automatically time out if their is no command line output in 30 minutes...'.
I'm running v2.6.0 of the PHP edition. Also tried on the demo version installed via composer and came across the same issue. Is there any way to disable this? I'd prefer it to run continuously.
Thank, Sean
@cssmonkey -
I'll see about exposing that as a config option. Obviously the error message is wrong as it's currently 10 minutes of idle before closing out. I want to provide a certain level of idle timeout just so the processes are cleaned up and don't interfere with restarting Pattern Lab in the event a terminal window or other process closes but doesn't nuke these PL processes.
OK thanks. It would be great if this was something that could be controlled in the config. Ta, Sean
Hi, Having control over the idle timeout would be a great addition. Cheers Steve
@sheathy @dmolsen I've submitted a pull request which allows for the duration to be controlled via the config file. See here: https://github.com/pattern-lab/patternlab-php-core/pull/92
Seems to work well for me but not extensively tested. Any feedback welcome.
A config option would be great. I have to restart Pattern Lab a lot because of the time out.
Any news on this ?
And I just want to add that this is a behavior bug too, the watch command is exiting even though there has been console output during that period. It's exiting with that message after 10 minutes even though I am doing lots of work and making changes and reload a lot, so it's not just a config issue.
Mac OSX 10.11.6 PHP 5.5.36
I discovered that you can override the timeout by making the changes below: /vendor/pattern-lab/core/src/PatternLab/Console/Commands/ServerCommand.php
Lines 61 and 66, change "idle" => 1800 to "idle" => 0
That doens't seem to change anything with my config, i still have the "timeout error". Did you changed something else?
Same here, timeout is after 10 minutes, though error still states 30 minutes. Could this possibly be a global PHP config issue?
Also experiencing this, unfortunately. Same problem when running php core/console --server --with-watch
: "pattern lab processes automatically time out if their is no command line output in 30 minutes..."
Any updates on this........................................
Any news?
I personally work around the issue with starting and restarting the watcher within a gulp task.
const spawn = require('child_process').spawn;
function patternLabGenerateAndWatchPatterns(done) {
const patternLabWatch = spawn('php', [
'core/console',
'--watch',
'--patternsonly',
]);
patternLabWatch.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
const patternLabIdleTimeout = 'pattern lab processes automatically time out if their is no command line output in 30 minutes...';
const patternLabPhpFatalError = 'PHP Fatal error';
const patternLabPatternsGenerated = 'site generation took';
const patternLabPatternsChanged = 'changed...';
const patternLabShouldReload = 'reload the website to see this change in the navigation...';
// Timeout workaround @see https://github.com/pattern-lab/patternlab-php/issues/369
if (data.indexOf(patternLabIdleTimeout) >= 0
|| data.indexOf(patternLabPhpFatalError) >= 0) {
patternLabGenerateAndWatchPatterns(false);
return;
}
if (data.indexOf(patternLabPatternsGenerated) >= 0) {
if (done !== false) {
done();
}
}
if (data.indexOf(patternLabPatternsChanged) >= 0
|| data.indexOf(patternLabShouldReload) >= 0) {
browser.reload();
}
});
patternLabWatch.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
patternLabWatch.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
}
Not the best circumstances, but works.
If you're using the watch command, the 10 minute timeout is coming from: /vendor/pattern-lab/core/src/PatternLab/Console/Commands/WatchCommand.php line 71. You can change the 'idle' value to your desired timeout.
Also, the timeout message comes from: /vendor/pattern-lab/core/src/PatternLab/Console/ProcessSpawner.php line 91 If you're pedantic like me, you'll want to fix that typo.