Closed futuretap closed 8 years ago
which log format are you using?
In this project I haven't (yet) changed to a compatible log format. However, it still shouldn't completely freeze Xcode, imo.
To answer your question, the log format looks like this:
2016-01-04 23:03:34:401 MyApp[44534:70b] (68d46900.0128)-[WMImageCache printCacheStats] mem: 0% (0/72)
I'm using CocoaLumberJack with colors enabled (using the XcodeColors plugin).
@futuretap of course it should not, I'm asking so we can find the issue causing it. Does it only happen on a really long lldb print or even on simpler ones ?
So far I can reproduce it only on a very long LLDB print. Shorter ones work fine.
@futuretap Does https://github.com/ewanmellor/KZLinkedConsole/tree/async-processing help?
Indeed, this helps and I can't reproduce the error anymore in my specific case.
I have made PR #20. This is the same code as mentioned just above, rebased onto current master. That PR should fix this issue then.
While Xcode doesn't hang anymore, it constantly uses 200% CPU. I verified that KZLinkedConsole regex stuff hogs 2 threads in Xcode. The CPU is still hogged when I delete the log (or even when I stop the debug session and close all windows!) which is embarrassing to me. Looks like the parsing job isn't cancelled.
@futuretap It's not doing that for me, and it's a regex so it shouldn't really run forever. Can you get any debugging info? A backtrace like the one at the start of this issue would be really useful. Alternatively, you can run the plugin using Xcode as normal, and it will launch another version of Xcode and you can debug the whole plugin that way. It would be great to know where that thread is spinning.
There is a let DEBUG_LOGGING = false
at the top of NSTextStorage+Extensions.swift
, and changing that to true will give some useful info.
Also, are you using https://github.com/ewanmellor/KZLinkedConsole/tree/async-processing or PR #20? (Just in case something got screwed up in the merge.)
I'm using your branch. I tried to let it run at 200% and it eventually finished. But it took like 10 minutes. I admit, the dictionary I printed was a 150 KB JSON with some huge strings. Maybe the Regex can be optimized to only search in the first 100 characters of a line? It seems awfully inefficient. I'm on a tight schedule and can't debug the issue myself, so I've disabled the plugin for now. Have you tried testing with such large data?
OK, well my patch just moves the work to a background thread, it doesn't change how much work gets done. A busy background thread is better than a hung UI thread of course. You're right though that 10 minutes of regexing is an awful lot. Searching only near the start of a line sounds like a good idea.
I'm assuming it's fixed now, let me know that's not the case
I just ran in an issue (in another project, not LinkedConsole), where icu::RegexMatcher::MatchAt
is stuck at 99% CPU... and it was just acting on a 436 character string. It feels like there are bugs in the regex matcher.
When debugging my app and printing a large dictionary in LLDB, Xcode hangs with KZLinkedConsole in the backtrace:
The issue is reproducible here and instantly goes away when removing the KZLinkedConsole plugin.