Closed dhritzkiv closed 2 months ago
Sorry that was my regression. Can you give me a test case? I can't repro:
func testURLCrashRegression() throws {
let html = """
<!DOCTYPE html>
<body>
<a href="https://secure.imagemaker360.com/Viewer/95.asp?id=181293idxIDX&Referer=&referefull="></a>
</body>
"""
_ = try SwiftSoup.parse(html)
}
This ran just fine
@dhritzkiv unless you can provide a repro test case, please try again with my related fixes here: https://github.com/scinfu/SwiftSoup/pull/276
@aehlke I should have clarified: trying to parse the contents of the above URL lead to the crash.
@dhritzkiv I fixed an obvious mistake I made that caused the regression so please give the fix a try and I'm certain it will resolve your issue.
I believe adding to this issue is better than creating a new issue. I too ran into a recursion error when calling let htmlDocument = try SwiftSoup(parse: html)
. I am scraping over 200 websites which was running on a 512mb server without an issue until I upgraded these packages to 2.7.0 at the initial time, then up to 2.7.3.
Downgrading to 2.6.1 fixed this recursion issue. I'm not sure what I can provide to help you if needed, I do have a saved Instruments log if that helps.
My PR fixes it but needs another automated test for verification that I haven't had time to add yet
Ah I understand! Sorry for the bother!
I experienced the same issue with version 2.7.3, SwiftSoup.parse(html)
make the memory usage increases infinitely and app crashes. I downgraded to version 2.7.2 to resolve the problem.
@phuongcsa @haIIux @dhritzkiv I released the fix: https://github.com/scinfu/SwiftSoup/releases/tag/2.7.4 it includes further utf8view-based optimization. It's a huge improvement, I hope it works well now for everyone. I added test coverage for this issue too.
@aehlke how about pod update latest version? Currently 2.7.3
@phuongcsa sorry can you submit a PR? I don't know or use cocoapods
Trying to parse certain URLs, such as this one, leads to a memory-related crash in 2.7.3. Downgrading to 2.7.2 avoids this.
Here's a reduced stack trace: