Yes, logging changes behavior so that races might get exposed, both by
slowing down the program and by introducing implicit synchronization points
(the writes to the output happen under a mutex, AFAIK).

But it does not introduce false positives. It exposes true positives. The
race are still there, even if the race detector can not detect them. Note
that the race detector is a heuristic. It will never find all race
conditions, only the ones encountered in the actual run.

On Sat, Jun 3, 2023 at 9:54 PM Levi Durfee <levi.dur...@gmail.com> wrote:

> Hello,
>
> While I was looking into a rarely occurring panic I used delve to debug
> the application. I set some log points in the Go standard library. I put
> one long point in src/net/lookup.go on line 298 so I could see that lookups
> were happening.
>
> I passed "-race" to the delve "build-flags" option so I could detect race
> conditions.
>
> I was able to find the race condition causing my panic and fix it, but I
> also noticed some other race conditions. *I only see these race
> conditions when I have a log point set. *The race conditions are in my
> code.
>
> While it's easy to fix these race conditions in my code, I wonder if the
> log point might produce false positives. I've read that the Go race
> detector messages should not be taken lightly.
>
> Could the log points be modifying the behavior, maybe slowing it down
> enough, so when debugging my app it has the opportunity to see the race
> conditions?
>
> I'm using Go 1.20.4
>
> https://github.com/golang/go/blob/go1.20.4/src/net/lookup.go#L298
>
> Thanks,
> Levi
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/4ea76bb3-57f5-42fa-8bce-249135161607n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/4ea76bb3-57f5-42fa-8bce-249135161607n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfE%2BG8Kf3ciWV3KZ13VW-YzC8sqt8JOmU8Ub9pvCRVQndg%40mail.gmail.com.

Reply via email to