bine icon indicating copy to clipboard operation
bine copied to clipboard

sharing client across multiple goroutines

Open unusualevent opened this issue 2 years ago • 4 comments

Is it possible to share the tor client object or the dialer across multiple goroutines?

I end up getting segfaults on the result (but that's probably just me being bad with pointers in the result channel in go)

what's the right way to share it or have multiple requests (say, two at the same time)?

unusualevent avatar Aug 10 '23 10:08 unusualevent

The response of the connection is locked and I don't remember, but you probably cannot use the client in multiple goroutines simultaneously. I suspect if I also locked the request you could, but the safest way is to only use from a single goroutine and make multiple clients if needed.

cretz avatar Aug 10 '23 12:08 cretz

I'm still getting weird SIGABRT errors if I'm making a new client for each of the goroutines.

is there any way to debug the problem?

unusualevent avatar Aug 10 '23 13:08 unusualevent

looks like I can get a SIGABRT even without using process/embed

unusualevent avatar Aug 10 '23 13:08 unusualevent

I don't work on this library much anymore. I think you'll have to debug why the tor process gives that.

cretz avatar Aug 11 '23 13:08 cretz