s-andrews / FastQC

A quality control analysis tool for high throughput sequencing data
GNU General Public License v3.0
445 stars 86 forks source link

Error not caught if children die from out of memory error #74

Closed didillysquat closed 3 years ago

didillysquat commented 3 years ago

FastQC is hanging and giving the error:

Singularity> fastqc -o . mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_PAPER = "de_DE.UTF-8",
    LC_ADDRESS = "de_DE.UTF-8",
    LC_MONETARY = "de_DE.UTF-8",
    LC_NUMERIC = "de_DE.UTF-8",
    LC_TELEPHONE = "de_DE.UTF-8",
    LC_IDENTIFICATION = "de_DE.UTF-8",
    LC_MEASUREMENT = "de_DE.UTF-8",
    LC_TIME = "de_DE.UTF-8",
    LC_NAME = "de_DE.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Started analysis of mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 5% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 10% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 15% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 20% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 25% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 30% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 35% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 40% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 45% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 50% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 55% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 60% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 65% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 70% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 75% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 80% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 85% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 90% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Approx 95% complete for mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz
Exception in thread "Thread-1" java.lang.OutOfMemoryError: GC overhead limit exceeded
    at java.lang.String.toCharArray(String.java:2899)
    at uk.ac.babraham.FastQC.Modules.NContent.processSequence(NContent.java:90)
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1"

This is happening in versions v0.11.8 and v0.11.9 as installed in the docker hub containers singlecellpipeline/fastqc:v0.0.2 and biocontainers/fastqc:v0.11.9_cv8.

To recreate the issue:

$ singularity shell docker://biocontainers/fastqc:v0.11.9_cv8
Singularity> fastqc -o . mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz

mpg_L16981-1_D4728_S14_R1_001.trimmed_1U.fq.gz

s-andrews commented 3 years ago

There must be something in that file which is causing fastqc to consume an unusual amount of memory such that the default allocation is being exhausted (but maybe only just?).

You can try adding -t 2 to the command which will increase the memory allocation (and increase the value above 2 if it still fails) and see if that fixes it. If not then there may be something causing runaway memory consumption and I'll track that separately if that's the case.

didillysquat commented 3 years ago

@s-andrews. Many thanks for your help! I can confirm that fastqc completes as expected with -t 2.

didillysquat commented 3 years ago

@s-andrews. As a side note, it would be ideal - for my purposes at least - if the program would terminate with an error when the above exception occurs rather than hanging. Thanks again.

s-andrews commented 3 years ago

Yeah, I'm not sure why that's happening. I guess we'd need to add a default error handler to the main thread so that it can tell if one of its children dies with an exception which doesn't have to be caught. I'll reopen this and take a look.

kapsakcj commented 3 years ago

+1 I've noticed this too on a small amount of samples run through fastqc. I don't believe an exit code is given & it just sort of hangs after the OOM error.

# paths shortened for readability
fastqc --outdir $PWD --threads 2 2000015529_1.clean.fastq.gz 2000015529_2.clean.fastq.gz
[...]
Approx 95% complete for 2000015529_1.clean.fastq.gz
Approx 95% complete for 2000015529_2.clean.fastq.gz
Analysis complete for 2000015529_1.clean.fastq.gz
Analysis complete for 2000015529_2.clean.fastq.gz
Exception in thread "Thread-2" java.lang.OutOfMemoryError: Java heap space
    at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:300)
    at java.lang.StringCoding.encode(StringCoding.java:344)
    at java.lang.StringCoding.encode(StringCoding.java:387)
    at java.lang.String.getBytes(String.java:958)
    at uk.ac.babraham.FastQC.Report.HTMLReportArchive.<init>(HTMLReportArchive.java:144)
    at uk.ac.babraham.FastQC.Analysis.OfflineRunner.analysisComplete(OfflineRunner.java:178)
    at uk.ac.babraham.FastQC.Analysis.AnalysisRunner.run(AnalysisRunner.java:110)
    at java.lang.Thread.run(Thread.java:748)

For reference I'm using v0.11.8 in this docker container here: https://hub.docker.com/r/staphb/fastqc/tags

Edit: Just noticed this may have been fixed in v0.11.9. I will upgrade to that version!

s-andrews commented 3 years ago

As I think this was fixed in 0.11.9 I'm closing this.