Skip to content

Additional logging for errors in ByteBufferAsyncProcessor - #190

Draft
Friedrich von Never (ForNeVeR) wants to merge 1 commit into
masterfrom
net211.im/cse-logging
Draft

Additional logging for errors in ByteBufferAsyncProcessor#190
Friedrich von Never (ForNeVeR) wants to merge 1 commit into
masterfrom
net211.im/cse-logging

Conversation

@ForNeVeR

Copy link
Copy Markdown
Collaborator

Since exceptions in this method may indicate a fatal error in the logging subsystem, the only place we're able to log them is LogLog.

Since exceptions in this method may indicate a fatal error in the
logging subsystem, the only place we're able to log them is LogLog.
myAllDataProcessed = false;
Monitor.Pulse(myLock);
LogLog.Error(ex);
throw;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Note that rethrowing with “throw;” instead of “throw e;” would “preserve the corrupting-ness”, meaning the whole process would probably be torn down as the re-thrown exception continued to propagate.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serge Baltic (@hypersw) suggests to use throw new Exception(e) to preserve the original callstack

@ForNeVeR Friedrich von Never (ForNeVeR) Dec 23, 2020

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this case, I don't think that's necessary.

Here, I want the following behavior from this code:

  1. If any exception (including the corrupted state one) is thrown, then the lock should be unlocked, and the exception should be logged without reentrancy into this code region, if possible (LogLog allows such logging).
  2. If the caller of this code uses [HandleProcessCorruptedStateExceptions], then let it to handle the exception as it wants to.
  3. If the caller of this code doesn't use [HandleProcessCorruptedStateExceptions], then fall back to the default behavior (say, crash the whole process).

My point is that the logger internals shouldn't modify the defaults chosen by the application domain policy or by the caller. I don't think that this code should care about transforming corrupted state exceptions into ordinary ones.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After an internal discussion, we've decided to make this behavior configurable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants