trispo / KFLogFormatter

A log formatter for Cocoa Lumberjack
MIT License
6 stars 3 forks source link

Crash on [dateFormatter stringFromDate:(logMessage->timestamp)] line #1

Open sarsonj opened 10 years ago

sarsonj commented 10 years ago

Hi,

I am getting crashes from some small fraction of users. The exception is:

-[KFLogFormatter formatLogMessage:] SIGABRT ABORT at 0x3607232c

at KFLogFormatter.m line 75 -[KFLogFormatter formatLogMessage:]

I have the newest KFLogFormatter version from github.

Thanks,

Jindrich

trispo commented 10 years ago

Strange. Any idea in which case the crash occurs?

sarsonj commented 10 years ago

Hi,

with next release I wanted to fix this issue, so that I checked what may be core of this problem. It looks like this is multithreading problem. NSDateFormatter is not thread safe. So that I put the line

dateString = [dateFormatter stringFromDate:(logMessage->timestamp)];

into synchronized block.

@synchronized {}

This should help.

trispo commented 10 years ago

Thanks for investigation. Could you please provide a pull request which fixes this issue?