lxc / go-lxc

Go bindings for liblxc
https://linuxcontainers.org/lxc
Other
431 stars 76 forks source link

[RFC] Stop using finalizers #116

Closed caglar10ur closed 5 years ago

caglar10ur commented 5 years ago

Handling our garbage explicitly is way more simpler and idiomatic then relying on runtime magic. Finalizers also are not guaranteed to run so stop using them, instead Container now provides Release() to call it via defer.

^ the idea is not to merge this as it is but start a discussion and learn whether you agree with this or not. I'll rebase/fix/cleanup after the discussion - this is for triggering the initial discussion.

P.S: this PR includes #114 for now

stgraber commented 5 years ago

Can you split in two PR, just keeping the finalizer changes in this one?

Btw, I agree with moving away from finalizers, we've had to do some weird tricks to have LXD and go-lxc behave in the past because of that :)

stgraber commented 5 years ago

Oops, sorry, just saw the other PR now :)

So just need to clean this one to only contain the finalizer bits.

caglar10ur commented 5 years ago

Glad to hear you agree :) Will rebase it on master and also check lxd and add Release() as needed

brauner commented 5 years ago

Thanks! :)