You’re right. Inspecting the code it is internally partitioned by P. 

I agree that it looks like the pool is being continually created. 

> On Jun 17, 2021, at 12:18 PM, Ian Lance Taylor <i...@golang.org> wrote:
> 
> On Thu, Jun 17, 2021 at 9:19 AM Peter Z <zjy19871...@gmail.com> wrote:
>> The original post is on  stackoverflow   
>> https://stackoverflow.com/questions/67999117/unexpected-stuck-in-sync-pool-get
>> Golang ENV:
>> go1.14.3 linux/amd64
>> Description:
>> We have about half a million agents running on each of our machines.The 
>> agent is written in Go. Recently we found that the agent may get stuck, no 
>> response for the sent requests. The metrics exported from the agent show 
>> that a channel in the agent(caching the request) is full. Deep into the 
>> goroutine stacks, we found that the goroutines consuming messages from the 
>> channel are all waiting for a lock.The goroutines Stack details are shown 
>> below.
> 
> That is peculiar.  What is happening under the lock is that the pool
> is allocating a slice that is GOMAXPROCS in length.  This shouldn't
> take long, obviously.  And it only needs to happen when the pool is
> first created, or when GOMAXPROCS changes.  So: how often do you
> create this pool?  Is it the case that you create the pool and then
> have a large number of goroutines try to Get a value simultaneously?
> Or, how often do you change GOMAXPROCS?  (And, if you do change
> GOMAXPROCS, why?)
> 
> 
>> The stack shows that all of the goroutines are waiting for the global lock 
>> in sync.Pool. But I can't figure out which gouroutine is holding the lock. 
>> There should be a gouroutine which has `sync.runtime_SemacquireMutex` in 
>> it's stack not at the top, but there isn't.
> 
> I don't think that is what you would see.  I think you would see a
> goroutine with pinSlow in the stack but with SemaquireMutex not in the
> stack.
> 
> 
>> Reproduce:
>> Can't find a way to reproduce this problem for now.
> 
> It's going to be pretty hard for us to solve the problem without a reproducer.
> 
> Ian
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/CAOyqgcW89OSL9frH%3D7f_gMga8qiKQ%2BR6cRnnWK3Kr5dKh3yLsg%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/EAB0653C-F779-46AB-B41F-CFF323455257%40ix.netcom.com.

Reply via email to