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

GoReplay v1.3.0_RC1 has goroutine leak when replaying traffic #926

Closed
code4wt opened this issue May 16, 2021 · 4 comments · Fixed by #927
Closed

GoReplay v1.3.0_RC1 has goroutine leak when replaying traffic #926

code4wt opened this issue May 16, 2021 · 4 comments · Fixed by #927

Comments

@code4wt
Copy link
Contributor

code4wt commented May 16, 2021

GoReplay stat log:

go ppref:
image

@urbanishimwe
Copy link
Collaborator

I don't think this is a goroutine leak!
the line that print those stats is https://github.com/buger/goreplay/blob/master/gor_stat.go#L54
the information printed is https://github.com/buger/goreplay/blob/master/gor_stat.go#L58

the last stat(gcount) returns

the number of goroutines that currently exist.

@code4wt
Copy link
Contributor Author

code4wt commented May 18, 2021

I don't think this is a goroutine leak!
the line that print those stats is https://github.com/buger/goreplay/blob/master/gor_stat.go#L54
the information printed is https://github.com/buger/goreplay/blob/master/gor_stat.go#L58

the last stat(gcount) returns

the number of goroutines that currently exist.

I don't think so. Please read the Transport#dialConn function code. At the same time, go pprof can also show that a lot of goroutines is blocked on the readLoop and writeLoop functions.

func (t *Transport) dialConn(ctx context.Context, cm connectMethod) (pconn *persistConn, err error) {
	pconn = &persistConn{....}
        // ......

	go pconn.readLoop()
	go pconn.writeLoop()
	return pconn, nil
}

@urbanishimwe
Copy link
Collaborator

urbanishimwe commented May 18, 2021

a lot of goreplay is blocked on the readLoop and writeLoop functions.

@code4wt this is because the output HTTP code uses a single client with persist connection enabled!
one goroutine that sends requests may live as long goreplay is running and I think this is okay!
opening many file socket may cause file leaks(and it did once)!

@code4wt
Copy link
Contributor Author

code4wt commented May 19, 2021

opening many file socket may cause file leaks(and it did once)!

you are right, I have encountered this problem. error msg is as follows:

[DEBUG][elapsed 1.000138155s]:
 output_http:0,0,0,325,325,3092
[DEBUG][elapsed 1.000139843s]:
 output_http:0,0,1,352,352,3048
[DEBUG][elapsed 162.021543ms]: [INPUT-FILE] err: "open /xyz/request_10.gor: too many open files"
[DEBUG][elapsed 27.39µs]: [INPUT-FILE] err: "open /xyz/request_11.gor: too many open files"
[DEBUG][elapsed 12.21µs]: [INPUT-FILE] err: "open /xyz/request_12.gor: too many open files"
[DEBUG][elapsed 11.534µs]: [INPUT-FILE] err: "open /xyz/request_13.gor: too many open files"
[DEBUG][elapsed 16.241µs]: [INPUT-FILE] err: "open /xyz/request_14.gor: too many open files"
......

@code4wt code4wt closed this as completed May 19, 2021
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

Successfully merging a pull request may close this issue.

2 participants