patternlab-php icon indicating copy to clipboard operation
patternlab-php copied to clipboard

pattern lab processes automatically time out

Open cssmonkey opened this issue 8 years ago • 15 comments

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 avatar Aug 12 '16 09:08 cssmonkey

@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.

dmolsen avatar Aug 12 '16 15:08 dmolsen

OK thanks. It would be great if this was something that could be controlled in the config. Ta, Sean

cssmonkey avatar Aug 16 '16 08:08 cssmonkey

Hi, Having control over the idle timeout would be a great addition. Cheers Steve

sheathy avatar Aug 16 '16 10:08 sheathy

@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.

cssmonkey avatar Aug 16 '16 13:08 cssmonkey

A config option would be great. I have to restart Pattern Lab a lot because of the time out.

dennisfrank avatar Nov 14 '16 01:11 dennisfrank

Any news on this ?

antoine3000 avatar Dec 13 '16 11:12 antoine3000

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

sirtimbly avatar Feb 14 '17 02:02 sirtimbly

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

adampengh avatar Apr 13 '17 18:04 adampengh

That doens't seem to change anything with my config, i still have the "timeout error". Did you changed something else?

antoine3000 avatar Jun 06 '17 13:06 antoine3000

Same here, timeout is after 10 minutes, though error still states 30 minutes. Could this possibly be a global PHP config issue?

iainvdw avatar Jun 08 '17 14:06 iainvdw

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..."

rbomhof avatar Aug 03 '17 14:08 rbomhof

Any updates on this........................................

jacobnijgh avatar Jan 09 '18 09:01 jacobnijgh

Any news?

hmalaud avatar Apr 11 '18 12:04 hmalaud

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.

vaxul avatar Apr 11 '18 13:04 vaxul

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.

QvateFrontend avatar Sep 24 '18 18:09 QvateFrontend