Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'pid' of null #14

Closed
kgdev opened this issue Apr 29, 2015 · 5 comments
Closed

Cannot read property 'pid' of null #14

kgdev opened this issue Apr 29, 2015 · 5 comments

Comments

@kgdev
Copy link

kgdev commented Apr 29, 2015

·
/home/ubuntu/weidian/backend/node_modules/gulp-develop-server/index.js:188 │············
var pid = gutil.colors.magenta( app.child.pid ); │············
^ │············
TypeError: Cannot read property 'pid' of null │············
at ChildProcess.stopped (/home/ubuntu/weidian/backend/node_modules/gulp-develop-server/index.js:188:45) │············
at ChildProcess.g (events.js:199:16) │············
at ChildProcess.emit (events.js:129:20) │············
at maybeClose (child_process.js:1015:16) │············
at Socket. (child_process.js:1183:11) │············
at Socket.emit (events.js:107:17) │············
at Pipe.close (net.js:485:12)

@kgdev
Copy link
Author

kgdev commented May 3, 2015

var pid = gutil.colors.magenta( app.child.pid );

TypeError: Cannot read property 'pid' of null

narirou added a commit that referenced this issue May 4, 2015
app.child might be an empty object.
If so, I will add more patch.
@nforysinski
Copy link

This issue is most persistent when watching the many results of a js/css set of gulp tasks. For instance, I have several js and css files that need to be minified and linted, which then get moved to a "dist" folder. My develop task is as follows:

gulp.task('watch', ['server:start'], function () {

    var notify = function(file) {
        server.changed( function( error ) {
            if( ! error ) lr.changed( file.path );
        });
    };

    gulp.watch(paths.css, ['sass']);
    gulp.watch(paths.html, ['compresshtml']);
    gulp.watch(paths.js, ['lint', 'compressjs']);
    gulp.watch(['./public/dist/**/*']).on('change', notify);
});

This yields the child pid error as well as several other event errors.

@chimerast
Copy link

I think this issue is caused by a bug of checking multiple restarts.

https://github.com/narirou/gulp-develop-server/blob/master/index.js#L206-L210

    // already called this function
    if( isChanged ) {
        isChanged = false; // *** I think this line cause the problem. It is unnecessary code. ***
        return done( null, 'Development server already received restart requests.', callback );
    }

It calls the kill function multiple times when the watcher task calls restart multiple times in a very short time.

@narirou
Copy link
Owner

narirou commented May 9, 2015

@kgdev, @nforysinski, @chimerast
Thank you for the detailed report.

As it is said, the value of isChanged was incorrect.
This bug made it possible to send a restart request many times.

But, as a result, I do not know whether this issue has been fixed yet.
I plan to verify the reproducibility of this issue, and add more test code.

@narirou
Copy link
Owner

narirou commented Nov 1, 2015

I think this error fixed by previous commit. (thanks @chimerast)
If not, please reopen this issue. Thanks.

@narirou narirou closed this as completed Nov 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants