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

Strider crashes while receiving the commits from GitHub #286

Closed
andunslg opened this issue Nov 24, 2013 · 36 comments
Closed

Strider crashes while receiving the commits from GitHub #286

andunslg opened this issue Nov 24, 2013 · 36 comments
Milestone

Comments

@andunslg
Copy link

I am running a Strider server inside a proxy, firewall. Sometimes it crashes with this error while receiving commits from git hub. Can you help,

buffer.js:499
buf.copy(buffer, pos);
^
TypeError: Object payload=%7B%22action%22%3A%22created%22%2C%22issue%22%3A%7B%22url%22%3A%22https%3A%2F%2Fapi.github.com%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%22%2C%22labels_url%22%3A%22https%3A%2F%2Fapi.github.com%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Flabels%7B%2Fname%7D%22%2C%22comments_url%22%3A%22https%3A%2F%2Fapi.github.com%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Fcomments%22%2C%22events_url%22%3A%22https%3A%2F%2Fapi.github.com%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Fevents%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fandunslg%2FSith%2Fissues%2F61%22%2C%22id%22%3A22992811%2C%22number%22%3A61%2C%22title%22%3A%22Added+Friends+are+not+shown+in+Friends+List%22%2C%22user%22%3A%7B%22login%22%3A%22andunslg%22%2C%22id%22%3A1448271%2C%22avatar_url%22%3A%22https%3A%2F%2F2.gravatar.com%2Favatar%2F4488b7fd7af9a7d16d02273b3d68cd55%3Fd%3Dhttps%253A%252F%252Fidenticons.github.com%252F22b9ee0470f23b65b94dca5cc08bb5e3.png%26r%3Dx%22%2C%22gravatar_id%22%3A%224488b7fd7af9a7d16d02273b3d68cd55%22%2C%22url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fandunslg%22%2C%22followers_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Ffollowers%22%2C%22following_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Ffollowing%7B%2Fother_user%7D%22%2C%22gists_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Fgists%7B%2Fgist_id%7D%22%2C%22starred_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Fstarred%7B%2Fowner%7D%7B%2Frepo%7D%22%2C%22subscriptions_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Fsubscriptions%22%2C%22organizations_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Forgs%22%2C%22repos_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Frepos%22%2C%22events_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Fevents%7B%2Fprivacy%7D%22%2C%22received_events_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fandunslg%2Freceived_events%22%2C%22type%22%3A%22User%22%2C%22site_admin%22%3Afalse%7D%2C%22labels%22%3A%5B%7B%22url%22%3A%22https%3A%2F%2Fapi.github.com%2Frepos%2Fandunslg%2FSith%2Flabels%2Fbug%22%2C%22name%22%3A%22bug%22%2C%22color%22%3A%22fc2929%22%7D%5D%2C%22state%22%3A%22open%22%2C%22assignee%22%3A%7B%22login%22%3A%22sachintharajith%22%2C%22id%22%3A1566998%2C%22avatar_url%22%3A%22https%3A%2F%2F0.gravatar.com%2Favatar%2F38daa524f81ff37b66abd2864636e7e6%3Fd%3Dhttps%253A%252F%252Fidenticons.github.com%252F760950acd91b798b629e1572a84d971a.png%26r%3Dx%22%2C%22gravatar_id%22%3A%2238daa524f81ff37b66abd2864636e7e6%22%2C%22url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fsachintharajith%22%2C%22followers_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Ffollowers%22%2C%22following_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Ffollowing%7B%2Fother_user%7D%22%2C%22gists_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Fgists%7B%2Fgist_id%7D%22%2C%22starred_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Fstarred%7B%2Fowner%7D%7B%2Frepo%7D%22%2C%22subscriptions_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Fsubscriptions%22%2C%22organizations_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Forgs%22%2C%22repos_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Frepos%22%2C%22events_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Fevents%7B%2Fprivacy%7D%22%2C%22received_events_url%22%3A%22https%3A%2F%2Fapi.github.com%2Fusers%2Fsachintharajith%2Freceived_events%22%2C%22type%22%3A%22User%22%2C%22site_admin%22%3Afalse%7D%2C%22milestone%22%3Anull%2C%22comments%22%3A2%2C%22created_at%22%3A%222013-11-20T14%3A03%3A52Z%22%2C%22updated_at%22%3A%222013-11-24T08%3A55%3A04Z%22%2C%22closed_at%22%3Anull%2C%22pu has no method 'copy'
at Function.Buffer.concat (buffer.js:499:9)
at IncomingMessage.onEnd (/usr/lib/node_modules/strider/node_modules/express/node_modules/connect/node_modules/raw-body/index.js:57:29)
at IncomingMessage.g (events.js:175:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)

@jaredly
Copy link
Member

jaredly commented Nov 24, 2013

I think that's due to a change in the connect middleware. What version of
express are you using?

Jared

On Sun, Nov 24, 2013 at 2:02 AM, Andun S.L. Gunawardana <
notifications@github.com> wrote:

I am running a Strider server inside a proxy, firewall. Sometimes it
crashes with this error while receiving commits from git hub. Can you help,

buffer.js:499
buf.copy(buffer, pos);
^
TypeError: Object
payload=%7B%22action%22%3A%22created%22%2C%22issue%22%3A%7B%22url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%22%2C%22labels_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Flabels%7B%2Fname%7D%22%2C%22comments_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Fcomments%22%2C%22events_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Frepos%2Fandunslg%2FSith%2Fissues%2F61%2Fevents%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fandunslg%2FSith%2Fissues%2F61%22%2C%22id%22%3A22992811%2C%22number%22%3A61%2C%22title%22%3A%22Added+Friends+are+not+shown+in+Friends+List%22%2C%22user%22%3A%7B%22login%22%3A%22andunslg%22%2C%22id%22%3A1448271%2C%22avatar_url%22%3A%22https%3A%2F%
2F2.gravatar.com
%2Favatar%2F4488b7fd7af9a7d16d02273b3d68cd55%3Fd%3Dhttps%253A%252F%
252Fidenticons.github.com%252F22b9ee0470f23b65b94dca5cc08bb5e3.png%26r%3Dx%22%2C%22gravatar_id%22%3A%224488b7fd7af9a7d16d0227
3b3d68cd55%22%2C%22url%22%3A%22https%3A%2F%2Fapi.github.com
%2Fusers%2Fandunslg%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fandunslg%22%2C%22followers_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Ffollowers%22%2C%22following_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Ffollowing%7B%2Fother_user%7D%22%2C%22gists_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Fgists%7B%2Fgist_id%7D%22%2C%22starred_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Fstarred%7B%2Fowner%7D%7B%2Frepo%7D%22%2C%22subscriptions_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Fsubscriptions%22%2C%22organizations_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Forgs%22%2C%22repos_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Frepos%22%2C%22events_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fandunslg%2Fevents%7B%2Fprivacy%7D%22%2C%22received_events_url%22%3A%22https%3A%2F%
2Fapi.github.com%2Fusers%2Fand
unslg%2Freceived_events%22%2C%22type%22%3A%22User%22%2C%22site_admin%22%3Afalse%7D%2C%22labels%22%3A%5B%7B%22url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Frepos%2Fandunslg%2FSith%2Flabels%2Fbug%22%2C%22name%22%3A%22bug%22%2C%22color%22%3A%22fc2929%22%7D%5D%2C%22state%22%3A%22open%22%2C%22assignee%22%3A%7B%22login%22%3A%22sachintharajith%22%2C%22id%22%3A1566998%2C%22avatar_url%22%3A%22https%3A%2F%
2F0.gravatar.com
%2Favatar%2F38daa524f81ff37b66abd2864636e7e6%3Fd%3Dhttps%253A%252F%
252Fidenticons.github.com
%252F760950acd91b798b629e1572a84d971a.png%26r%3Dx%22%2C%22gravatar_id%22%3A%2238daa524f81ff37b66abd2864636e7e6%22%2C%22url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%22%2C%22html_url%22%3A%22https%3A%2F%2Fgithub.com%2Fsachintharajith%22%2C%22followers_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Ffollowers%22%2C%22following_url%22%3A%22https%3A%2F%
2Fapi.github.com%2Fusers%2Fsachintharajith%2Ffollowing%7B%2Fother_user%7D%22%2C%22gists_url%22%3A%22
https%3A%2F%2Fapi.github.com
%2Fusers%2Fsachintharajith%2Fgists%7B%2Fgist_id%7D%22%2C%22starred_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Fstarred%7B%2Fowner%7D%7B%2Frepo%7D%22%2C%22subscriptions_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Fsubscriptions%22%2C%22organizations_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Forgs%22%2C%22repos_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Frepos%22%2C%22events_url%22%3A%22https%3A%2F%
2Fapi.github.com
%2Fusers%2Fsachintharajith%2Fevents%7B%2Fprivacy%7D%22%2C%22received_events_url%22%3A%22https%3A%2F%
2Fapi.github.com%2Fusers%2Fsachintharajith%2Freceived_events%22%2C%22type%22%3A%22User%22%2C%22site_admin%22%3Afalse%7D%2C%22milestone%22%3Anull%2C%22comments%22%3A2%2C%22created_at%22%3A%222013-11-20T14%3A03%3A52Z%22%2C%22updated_at%22%3A%222013-11-24T08%3A55%3A04Z%22%2C%22closed_at%22%3Anull%2C%22pu
has no method 'copy'
at Function.Buffer.concat (buffer.js:499:9)
at IncomingMessage.onEnd
(/usr/lib/node_modules/strider/node_modules/express/node_modules/connect/node_modules/raw-body/index.js:57:29)
at IncomingMessage.g (events.js:175:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)


Reply to this email directly or view it on GitHubhttps://github.com//issues/286
.

@andunslg
Copy link
Author

I have installed the strider server using command "sudo npm install -g strider". How can I check the express version of that?

@jaredly
Copy link
Member

jaredly commented Nov 24, 2013

which strider
To find the install location

@andunslg
Copy link
Author

Sorry about asking all these things. I am new to NodeJS. I found that strider is in /usr/bin. I run the npm list command to find the version of express using sudo but it says,

npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT, open '/usr/bin/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install"
npm ERR! cwd /usr/bin
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! path /usr/bin/package.json
npm ERR! code ENOPACKAGEJSON
npm ERR! errno 34
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/bin/npm-debug.log
npm ERR! not ok code 0

@andunslg
Copy link
Author

I have found that strider folder is int /usr/lib/node_modules/strider. When I run npm list there, I got the express version as express@3.4.2.

@niallo
Copy link
Member

niallo commented Nov 24, 2013

On https://public-ci.stridercd.com (which doesn't crash on github web hooks) we have:

  • express@3.4.2
    • connect@2.9.2

Which version of connect do you have, @andunslg ?

@andunslg
Copy link
Author

When I run the command "npm list | grep connect" I get,

ââ⬠connect@2.7.11
âââ connect-flash@0.1.1
ââ⬠connect-mongo@0.3.3
âââ connect-slashes@0.0.11
â ââ⬠connect@2.9.2
â ââ⬠connect@2.4.6

@niallo
Copy link
Member

niallo commented Nov 25, 2013

Actually I'm seeing this now also in the logs of https://public-ci.stridercd.com.

@niallo
Copy link
Member

niallo commented Nov 25, 2013

Related to #247

@jaredly
Copy link
Member

jaredly commented Nov 25, 2013

yeah - going back to 3.4.2 fixed it in the few tests that I did, but maybe there's some race condition

@niallo
Copy link
Member

niallo commented Nov 25, 2013

let's see if we can come up with a reproducible test case. once we have that, it should be possible to track it down.

@andunslg
Copy link
Author

In my case I am the owner of the git repo. There are several others contributing to the repo. For all my commits strider works fine. But when other person commits it crashes. Is this related to network level issues? Proxy filtering packets kind of things?

@jaredly
Copy link
Member

jaredly commented Nov 25, 2013

Hmm that's an interesting insight. I don't think it would be network level, though

@andunslg
Copy link
Author

Isn't there a quick fix for this? Cant we revert to a older stable version? Can you help me in that. I ma using this to my research project at uni. If you can help me that will be great!

@jaredly
Copy link
Member

jaredly commented Nov 25, 2013

Yeah, I'm looking into fixing it today.

On Mon, Nov 25, 2013 at 8:28 AM, Andun S.L. Gunawardana <
notifications@github.com> wrote:

Isn't there a quick fix for this? Cant we revert to a older stable
version? Can you help me in that. I ma using this to my research project at
uni. If you can help me that will be great!


Reply to this email directly or view it on GitHubhttps://github.com//issues/286#issuecomment-29210296
.

@niallo
Copy link
Member

niallo commented Nov 25, 2013

@andunslg the quickest fix is probably to run Strider with a process monitor like superverisord or forever, so that it automatically restarts on a crash.

@andunslg
Copy link
Author

But after restarting, the commits which created the crash are missed! Otherwise I have to retest manually! Can we schedule a automatic test after each restart?

@niallo
Copy link
Member

niallo commented Nov 26, 2013

Not easily. This is a bug, I don't have anything other than a sub-optimal work-around right now I'm afraid.

@chrisfosterelli
Copy link

If you restart Strider you can manually "Retest and deploy" and it will grab your latest version. But this is pretty breaking to the workflow. :(

@niallo
Copy link
Member

niallo commented Nov 27, 2013

Yeah, it sucks. We're working on it...

@niallo
Copy link
Member

niallo commented Nov 27, 2013

The hard thing about this is I can't figure out how to reproduce it reliably. At least not with Github's "test web hook" payloads. I'll try to write a tool which emulates the web hooks but that is a little bit of work.

Can any of you reproduce it reliably?

@chrisfosterelli
Copy link

I can reproduce it reliably, but not without a fair bit of manual work each time. Every pull request merged into master of a repo configured with Strider causes Strider to exit. I'm not sure about an easy way to automate that for testing.

@niallo
Copy link
Member

niallo commented Nov 28, 2013

Thanks for the pointer. I will see if I can make a tool which emulates that.

@andunslg
Copy link
Author

Do we have a solution?

@bryce-larson
Copy link

I'm having the same problem was well. I can currently reproduce it pretty reliably. Is there a way to give you more debugging info?

buffer.js:499
buf.copy(buffer, pos);
^
TypeError: Object payload=%7B%22ref%22%3A%22refs%2Fheads%2Fmaster%22%2C%22after%22%3A%22720d3d27ca60f6a7212e248b6b5259f5ee088f0d%22%2C%22before%22%3A%22d3dc6843be8aa222bcf14594a2b7e63203865c46%22%2C%22created%22%3Afalse%2C%22deleted%22%3Afalse%2C%22forced%22%3Afalse%2C%22compare%22%3A%22https%3A%2F%2Fgithub.com<..clipped...>added%22%3A%5B%22app%2Fbuild.json%22%2C%22app%2Fconfig%2Fdefault-co has no method 'copy'
at Function.Buffer.concat (buffer.js:499:9)
at IncomingMessage.onEnd (/home/ubuntu/ci/node_modules/strider/node_modules/express/node_modules/connect/node_modules/raw-body/index.js:57:29)
at IncomingMessage.g (events.js:175:14)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:910:16
at process._tickCallback (node.js:415:13)

@niallo
Copy link
Member

niallo commented Dec 1, 2013

@bryce-larson how do you reproduce it?

@bryce-larson
Copy link

Not exactly sure why it is causing it, but my ci server is currently throwing this error. Here is a bit about my setup:

  • private repo
  • owner is not the committer
  • checking into the master branch

strider version": "1.4.1"

Performing a "Test Hook" will throw the error.

Would you like any more infor?

@niallo
Copy link
Member

niallo commented Dec 1, 2013

Any chance you could paste a copy of the HTTP payload which crashes the server?

@bryce-larson
Copy link

Some private(ish) information in the response, so I emailed it to you.
I don't think the error message contains the entire payload, did you want me to modify the /api/github/webhook, so that I can give you more information?

@niallo
Copy link
Member

niallo commented Dec 1, 2013

Thanks, yes, as much info as possible please. You could also look at adding an additional web hook to http://requestb.in and getting the output there.

@bryce-larson
Copy link

Okay, email you a RequestBin and a stack trace.
Get tool, btw.

A bit more info if you want it:

"connect": {
"version": "2.7.11",
"express": {
"version": "3.4.2",
node v0.10.22

@niallo
Copy link
Member

niallo commented Dec 1, 2013

Thanks a lot @bryce-larson. Hopefully I can use this to repro.

@niallo
Copy link
Member

niallo commented Dec 1, 2013

Ok I have made good progress since I can now reproduce the bug. The key is that the web hook POST from Github must be large enough that it is sent in HTTP chunked encoding. A way I forced the web hook to be very large was to create a thousand new files in a single git commit and then git push it. This results in Github's web hook being a very large JSON payload.

Once you push something that can crash the server, you can force Github to send it on-demand using the "test web hooks" button.

Now, the issue is that if it is sent in HTTP chunked encoding, a type-mismatch issue in the connect raw-body middleware is triggered:

https://github.com/stream-utils/raw-body/blob/0.0.3/index.js#L36

The data being received by the onData handler can be of type string rather than buffer, which triggers the crash.

However the latest version of raw-body (1.1.1) fixes this. Express 3.4.5 (released 3 days ago) uses a version of Connect which requires that.

I have just upgraded Strider to latest Express and patched our post-body middleware to work with this, which should fix the crash.

@niallo niallo closed this as completed in 6f79511 Dec 1, 2013
@chrisfosterelli
Copy link

Awesome, thanks!

@andunslg
Copy link
Author

andunslg commented Dec 1, 2013

Thanks!

@bryce-larson
Copy link

Tested and working! Thank you.

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

5 participants