Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tentative nullref fix for LogSource #7078

Merged
merged 2 commits into from
Jan 31, 2024

Conversation

ilmax
Copy link
Contributor

@ilmax ilmax commented Jan 30, 2024

Fixes #6966

Changes

Please provide a brief description of the changes here.

As mentioned here I'm getting this error 100% of times when starting the application that's configure to use Akka.Remoting.
Looking at the source code it seems to me that there's a race between Remoting and the Logging configuration.

Apparently the logging always wins the race and consequently throws a nullref. This exception is swallowed but I was wondering if the suggested fix may be of any value since it's unlikely that the remoting system may successfully configure (this is an educated guess) after the introduced null check because the offending path has only:

  • a method call
  • a string compare
  • an if statement

Before throwing the nullref, also since the fallback is exactly the same as what the null path takes in my PR, I think that removing the start-up exception may valuable, but I'm not an expert in Akka source and I may be missing out here.

@Arkatufus FYI since you responded in the aforementioned issue.

Comment on lines 110 to 115
var defaultAddress = system.AsInstanceOf<ExtendedActorSystem>().Provider.DefaultAddress;
if (defaultAddress is null)
{
return a.Path.ToString();
}
return a.Path.ToStringWithAddress(defaultAddress);
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be simplified by removing the try...catch block altogether

Copy link
Contributor

@Arkatufus Arkatufus left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution :)

@Arkatufus Arkatufus enabled auto-merge (squash) January 31, 2024 18:17
@Aaronontheweb Aaronontheweb modified the milestones: 1.5.16, 1.5.17 Jan 31, 2024
@ilmax
Copy link
Contributor Author

ilmax commented Jan 31, 2024

Oh, I'm glad I was helpful (and will be happy to not see this exception anymore).

@Aaronontheweb Aaronontheweb merged commit 46d6711 into akkadotnet:dev Jan 31, 2024
8 of 12 checks passed
@ilmax ilmax deleted the fix-logging-nullref branch January 31, 2024 22:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ActorPath.ToStringWithAddress is given null address parameter
3 participants