Caddy: Deadlock in Stop function

Created on 19 Jul 2016  Â·  5Comments  Â·  Source: caddyserver/caddy

(Are you asking for help with using Caddy? Please use our forum instead: https://forum.caddyserver.com. If you are filing a bug report, please answer the following questions. If your issue is not a bug report, you do not need to use this template. Either way, please consider donating if we've helped you. Thanks!)

1. What version of Caddy are you running (caddy -version)?

master branch

2. What are you trying to do?

just noticed deadlock

3. What is your entire Caddyfile?

-

4. How did you run Caddy (give the full command and describe the execution environment)?

5. What did you expect to see?

6. What did you see instead (give full error messages and/or log)?

7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?

Just was looking through the code (I am not caddy user yet) and noticed that Stop func (https://github.com/mholt/caddy/blob/master/caddy.go#L698) acquires instancesMu.Lock() and then calling Stop() method of each instance. Inside that method instanceMu also must be acquired (https://github.com/mholt/caddy/blob/master/caddy.go#L96).

I was able to reproduce this just trying to call caddy.Stop() function after instance started.

bug

Most helpful comment

All taken care of. :+1:

All 5 comments

Oops. Not sure how that slipped through. :confused: Thanks for the report!

Hmm. Think this might be me...but did test (a bit). Anyway don't have time
to look into this today :(

On 19 Jul 2016 2:55 p.m., "Matt Holt" [email protected] wrote:

Oops. Not sure how that slipped through. 😕 Thanks for the report!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mholt/caddy/issues/941#issuecomment-233640211, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAVkW__LPO0uQMLst8KleyegxDQj6Lfiks5qXNc-gaJpZM4JPv1x
.

Also should be an easy fix (I hope)

On 19 Jul 2016 2:57 p.m., "Miek Gieben" [email protected] wrote:

Hmm. Think this might be me...but did test (a bit). Anyway don't have time
to look into this today :(

On 19 Jul 2016 2:55 p.m., "Matt Holt" [email protected] wrote:

Oops. Not sure how that slipped through. 😕 Thanks for the report!

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/mholt/caddy/issues/941#issuecomment-233640211, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAVkW__LPO0uQMLst8KleyegxDQj6Lfiks5qXNc-gaJpZM4JPv1x
.

Miek, I think this was me actually. I just realized I never use caddy.Stop() in 0.9, only inst.Stop().

All taken care of. :+1:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mholt picture mholt  Â·  3Comments

lorddaedra picture lorddaedra  Â·  3Comments

mikolysz picture mikolysz  Â·  3Comments

billop picture billop  Â·  3Comments

ericmdantas picture ericmdantas  Â·  3Comments