core icon indicating copy to clipboard operation
core copied to clipboard

avoid careless calls to unref functions

Open adbenitez opened this issue 3 years ago • 1 comments

adbenitez avatar Jun 11 '22 03:06 adbenitez

As for avoiding eprintln! in deltachat-ffi, maybe make a macro that logs these errors via event emitter in all functions where context is passed as an argument? This will prevent the core from breaking layout in all places except when the context itself cannot be constructed.

can you do that? also in lib.rs when the db path can be opened due to file permissions an error is printed to screen despite error being tracked via IMEX anyway

adbenitez avatar Jun 11 '22 14:06 adbenitez

As for avoiding eprintln! in deltachat-ffi, maybe make a macro that logs these errors via event emitter in all functions where context is passed as an argument? This will prevent the core from breaking layout in all places except when the context itself cannot be constructed.

can you do that? also in lib.rs when the db path can be opened due to file permissions an error is printed to screen despite error being tracked via IMEX anyway

This actually does not make much sense, because lots of functions print "ignoring careless call" when they receive NULL instead of a context.

link2xt avatar Dec 06 '22 22:12 link2xt

is this still worthwhile to pursue this issue at all now that jsonrpc-python-bindings are on the rise?

hpk42 avatar Dec 06 '22 22:12 hpk42

At least the PR I think can be closed, it's not a solution really, just a workaround.

yeah I tried just to avoid calling the unref on NULL but the real issue is that the bindings are not checking for NULL values, I don't even know if all that calls can return NULL, the one I was having issues with was dc_context_unref when passing a db path that core didn't have permission to write.

Made a fix for this: #3818 If there are more problems like this, they should be solved similarly, not just by ignoring them.

link2xt avatar Dec 06 '22 22:12 link2xt

hi, yes, completely forgot about this, this PR was just a hack, we can close it,

side comment: btw the current state of the python bindings is bad I see a lot of "unref warnings" stuff and here are some reports that it sometimes freeze, and not to mention the potential memory leak making the bot go from 50MB to GBs of RAM over time, so I think it is good that we plan to move to the rpc thing

adbenitez avatar Dec 06 '22 23:12 adbenitez