dat icon indicating copy to clipboard operation
dat copied to clipboard

Disabling logger makes errors become nil, and generates nil pointer dereferences

Open manuel-huez opened this issue 8 years ago • 3 comments

We had to disable error logging coming from dat- especially since some queries are extremely long and we don't want to print them when a query crashes. Doing so started generating pointer dereferences in sqlx-runner/execer.go when trying to access res.RowsAffected, meaning res is nil. Doing some digging, it turns out the exec function is returning nil for both values, even when an error should be returned. In fact, logSQLError now seems to be returning nil, even if the parameter isn't.

Our environment variable is set to LOGXI=dat*=OFF.

I'm not sure if this is an intended behavior of the logger, but it is generating some extremely bad side-effects on our production environment.

manuel-huez avatar Jan 11 '17 10:01 manuel-huez

The same issue.

aksentyev avatar Feb 03 '17 10:02 aksentyev

And such behavior breaks errors handling, because all errors becomes nil

aksentyev avatar Feb 03 '17 10:02 aksentyev

This is a problem within the logging package (one I wrote). I found the bug in logger and will update dat soon.

mgutz avatar Feb 05 '17 21:02 mgutz