comtypes icon indicating copy to clipboard operation
comtypes copied to clipboard

Logging is sometimes re-entrant

Open LeonarddeR opened this issue 6 years ago • 4 comments

Within NVDA, we use comtypes to access com objects. Until now, we ignored logging messages coming from comtypes. When I started investigating piping comtypes logging to the NVDA log, I noticed that NVDA crashed in a few minutes after enabling debug logging.

Here is an example traceback generated when comtypes logging is set to debug. It looks like some log messages generate another message that causes re-entrancy.

LeonarddeR avatar Oct 17 '19 09:10 LeonarddeR

@leonardder

Is this still a problem?

junkmd avatar Dec 03 '22 06:12 junkmd

From brief look it seems a threading issue. See this StackOverflow question: https://stackoverflow.com/q/45680378/3648361 From the first look I couldn't understand whether we can fix it in comtypes or not.

vasily-v-ryabov avatar Dec 04 '22 12:12 vasily-v-ryabov

It's a long time ago I investigated this. There have been some logging changes in NVDA related to comtypes, see https://github.com/nvaccess/nvda/pull/14317

LeonarddeR avatar Dec 05 '22 09:12 LeonarddeR

@leonardder

I don't think this issue is limited to comtypes.

I think @vasily-v-ryabov is right, it is a problem that occurs with asynchronous, parallelprocessing or multiprocessing. I think the solution is to eliminate logging from comtypes or to prevent your project's logging from picking up the library's logs.

I am not in favor of eliminating logging from comtypes.

Your project PR seems to have accomplished not picking up any logs on the library side.

What about this issue?

junkmd avatar Dec 05 '22 12:12 junkmd