-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heap space!! java.lang.OutOfMemoryError: Java heap space at java.util.Arrays.copyOf(Arrays.java:3332) #317
Comments
@jrwiebe @lintool @ianmilligan1 finally wrote it up. Let me know if I missed anything, or y'all want me to provide more info. |
@ruebot, you say:
Can you clarify this? Are you saying that jobs run with the same parameters against other large collections – in terms of total archive size – do not result in heap space errors? Because in my testing I didn't find this to be the case. It seemed like the error was rather a function of the total size of all the WARCs being operated on simultaneously. I think I was seeing jobs bail when they didn't have about 4 times the amount of memory as I found this garbage collection log analyzer useful for trying to understand how memory was being used, though I'm still puzzled that so much memory is being used. See for example how much memory is used by a job that simply chains To generate garbage collection logs you want to do something like this (the
For the record, I'm pretty certain KryoSerializer doesn't offer any benefits for this problem; I just kept using it because I copied @ruebot's command line. I ran tests with and without some of the other tuning options as well, and was seeing similar results. |
Sorry, yeah, that's kinda vague. I meant overall, we've analyzed 170T of collections ranging from under a 1G of WARCs up to 12T with the same basic Spark settings. I added the KryoSerializer during troubleshooting because it looked like it got further along in some cases, and reading up on it, it made sense at the time. Thanks for putting in the GC info. I was hoping to tease it out by creating the issue 😄 |
...and a single WARC as large as 80G. |
Reading the garbage collection post reminded me that Spark allocates (not sure if that is the right word), ~55-60% of "storage" memory for executors. A smarter version of me would have bookmarked that Stackoverflow or Spark mailing list thread. But, I can provide a screenshot of a the Spark UI of a currently running job. That's a job running with 30 threads, and 105G of RAM allocated: |
I'm going to start adding collection info on failed collections here:
|
As a sanity check, I went to the data directory and did this:
2878090679 = 2,878,090,679 ~ 2.9 GB. A bit silly to have records that big... dunno if this is the source of your errors though. |
So an individual record that’s almost 3GB? I wonder if we could implement a default that skips records greater than say a GB? Or lower? I can imagine users who might want to work with big files - video etc - but for the most part, and with our generic processing pipeline, we could do without. |
I'm not certain that record size is the issue. I've collected some data from a number of collections that fail, and succeed. Large record size doesn't appear to be the sole factor in failure or success. We have some that are well above what @lintool listed having been a part of successful jobs. I'll take some time over the coming days, or weeks 😓, to try and isolate some of the WARCs that are actually causing the problems, then we can proceed digging in further from there if that makes sense. PQ: Fails on
|
Hit a very similar error a couple times over the last few days on two different collections with Java 11 and Spark 3.0.0. I had initially thought it was a freak new error because of the new setup, but I believe this is the same error that we've all been running into for a few years now, and is definitely a blocker for 1.0.0.
The common thread following the stack trace in all the errors in this issue are @lintool had previously patched the issue with lintool/warcbase@16db934, which I believe was meant to just skip over broken records, but didn't address the underlying issue that @anjackson brought up here; that we're hitting the 2G array limit size in Java. I think the best path forward then is to decide if we want to truncate payloads like Andy suggested (I'm not 100% sure we should be do that), or update the |
One important point I left out that should reinforce the conclusion of the above comment, is that I'm fairly certain that the issue isn't WARC/ARC file specific. One example to share is from 3940 (Alberta Oil Sands). It's about a 25G collection. If I run it on all the files (25 files), it will fail with the error listed in the comment immediately above. If I pull out the WARC that causes the analysis to fail, the job with the 24 remaining WARCs completes successfully. That would lead one on to believe it's just a bad WARC, so toss it out! But, it is not. If I run the same job on just that WARC alone, it completes successfully. Which, I believe reinforces the above note about hitting the 2G array limit in Java since we're juggling all the records in memory at a given time. |
There's a cruel irony in the fact that mere hours before @ruebot's comment I deleted all my old memory profiles from tests I ran trying to understand this issue a year ago. Not that I think they would be particularly helpful – I never managed to figure out what were the limits of memory allocation, file size, workers, etc., that would produce the error. |
|
EnvironmentAUT
ArchiveSpark
ExperimentI was able to reproduce this issue with a much smaller set of warc files, I selected a subset of ARCHIVEIT-10689 (TEST-JOB727752) which is about 7.23G and I was simply doing I was doing it in spark-shell with the following flags:
At first I thought this is the same issue caused by manipulating too many records in the memory and somehow hitting the 2G array limit as mentioned by @ruebot but when I test that single WARC file (which is ~1G in size), the error persisted!
Perhaps this is a corrupted WARC? However, I also tried doing a similar operation using ArchiveSpark, which completed without errors.
(I have observed that ArchiveSpark and aut returns different ObservationSo I dig further into
|
@adamyy thanks for the update. What about a simple fix like adding a content length filter and skipping records above a certain threshold? We can define the threshold in a static, set it to something reasonable that the user can adjust if need be. |
@lintool I think that should mute the issue but going forward we might want better payload handling per described #494 ArchiveSpark's |
@lintool Would love to! Working on one now. Looking back at the original issue though, it appears to me that #317 (comment) and the original issue #317 could be two distinct but related problem. I think original OOM is caused by the fact that because we use strings and not streams, we are forcing the content of some absurdly large WARCs to be kept in the memory. Though @ruebot also mentioned that some collections with large WARCs such as |
@adamyy Sorry for the delay, I am on family leave, and @lintool should have at the very least tipped you off to this if he put you on to working on
This is not a solution. This is just hiding the actual problem, and throwing out information that a researcher, or archivist could have a need for. So, @adamyy I would close #496. Additionally, for future reference, you'll need to add tests for a PR to be accepted.
I'd argue they are the same thing, but we don't have to split hairs.
Agreed in principle. The actual size of the ARCs or WARCs files is a red herring IMO. What matters is the record size, as you noted in my #317 (comment) comment. As of my last deep dive in this issue (late June), my inclination was that That said, if you'd like to take a crack at replacing the string implementation with a streaming implementation, that would be much appreciated. In a perfect world, we should be able to process large collections with less than the amount of RAM you have available on your laptop. The caveat here being, I won't really be around review and test anything for a few weeks. As for the count difference between |
* fix discardDate issue * update tests for #494 * add test for #493 * add test for #532 * move issue specific tests to their own directory * add copyright statement to SparklingArchiveRecord * move webarchive-commons back to 1.1.9 * resolves #532 * resolves #494 * resolves #493 * resolves #492 * resolves #317 * resolves #260 * resolves #182 * resolves #76 * resolves #74 * resolves #73 * resolves #23 * resolves #18
Similar to #492 (comment), I tested the initial collection causing issues (10689) on tuna with just 8GB, and ran the same analysis without incident. I'll do some more exhaustive testing of problematic collections we had over the next few days, but I think we might have resolved this issue with #533. |
Describe the bug
On a number FDLP and Stanford collections, we run into this space heap space error, and it kills the Spark job. Upon investigation, this does not seem to be a problem with a large ARC/WARC or large collection. This happens on small and large collections.
To Reproduce
Steps to reproduce the behavior on
tuna
:/tuna1/scratch/nruest/auk_collection_testing/10689
/home/ruestn/spark-2.4.1-bin-hadoop2.7/bin/spark-shell --master local[30] --driver-memory 105g --conf spark.network.timeout=10000000 --conf spark.executor.heartbeatInterval=600s --conf spark.driver.maxResultSize=4g --conf spark.serializer=org.apache.spark.serializer.KryoSerializer --conf spark.shuffle.compress=true --conf spark.rdd.compress=true -Djava.io.tmpdir=/tuna1/scratch/nruest/tmp --jars /home/ruestn/aut/target/aut-0.17.1-SNAPSHOT-fatjar.jar -i /tuna1/scratch/nruest/auk_collection_testing/10689/133/spark_jobs/10689.scala 2>&1 | tee /tuna1/scratch/nruest/auk_collection_testing/10689/133/spark_jobs/10689.scala-test.log
Expected behavior
Shouldn't hit the heap error.
Environment information
--jars
and--pagackes
/home/ruestn/spark-2.4.1-bin-hadoop2.7/bin/spark-shell --master local[30] --driver-memory 105g --conf spark.network.timeout=10000000 --conf spark.executor.heartbeatInterval=600s --conf spark.driver.maxResultSize=4g --conf spark.serializer=org.apache.spark.serializer.KryoSerializer --conf spark.shuffle.compress=true --conf spark.rdd.compress=true -Djava.io.tmpdir=/tuna1/scratch/nruest/tmp --jars /home/ruestn/aut/target/aut-0.17.1-SNAPSHOT-fatjar.jar -i /tuna1/scratch/nruest/auk_collection_testing/10689/133/spark_jobs/10689.scala 2>&1 | tee /tuna1/scratch/nruest/auk_collection_testing/10689/133/spark_jobs/10689.scala-test.log
Additional context
tuna
, the job runs fine./tuna1/scratch/nruest/auk_collection_testing/9635
is another collection to test onThe text was updated successfully, but these errors were encountered: