In fact the code you reference - the close() - does things the Go docs warn specifically not to do. 

You may be better off using runtime.AddCleanup()



On Mar 19, 2025, at 6:32 AM, Robert Engels <reng...@ix.netcom.com> wrote:


In principle, I would argue that there is a correctness problem. You should not rely on finalizers ever - they are catches and often optional - so the design relying on finalizers to run is what is broken. 

In the real world they can make solving certain problems much easier - especially with shared resources. I know Java has deprecated them in lieu of other technologies like Cleaners. 


On Mar 19, 2025, at 6:19 AM, Gavra <gav...@gmail.com> wrote:

https://github.com/hirochachacha/go-smb2/blob/c8e61c7a5fa7bcd1143359f071f9425a9f4dda3f/client.go#L1063
We are looking for why exactly it blocked (probably incorrect ctx) but I think this close should run in a goroutine.

On Wednesday, 19 March 2025 at 12:29:34 UTC+2 Brian Candler wrote:
On Wednesday, 19 March 2025 at 09:55:58 UTC Gavra wrote:
This finalizer blocks the runtime's finalizer goroutine

Out of interest, what made it block? Was the finalizer doing some channel communication, for example?

--
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 visit https://groups.google.com/d/msgid/golang-nuts/5c7c034d-3bc6-4fe5-82bb-a318310bd82fn%40googlegroups.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 visit https://groups.google.com/d/msgid/golang-nuts/6AABBB52-5BC6-4874-900B-C423E37952C4%40ix.netcom.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 visit https://groups.google.com/d/msgid/golang-nuts/06F75F94-7947-4A97-98EA-DB1B6A47C8E8%40ix.netcom.com.

Reply via email to