Closed mdorf closed 4 years ago
This error affects both 4store and AllegroGraph.
I believe the problem is caused by this code in index
method of ontology_submission.rb
:
https://github.com/ncbo/ontologies_linked_data/blob/master/lib/ontologies_linked_data/models/ontology_submission.rb#L1153
csv_writer = LinkedData::Utils::OntologyCSVWriter.new
csv_writer.open(self.ontology, self.csv_path)
csv_writer.open
runs:
@file = File.new(path, 'w')
@gz = Zlib::GzipWriter.new(@file)
Eventually, there is a call to csv_writer.close
, but if there is an earlier exception thrown, this code never executes:
https://github.com/ncbo/ontologies_linked_data/blob/master/lib/ontologies_linked_data/models/ontology_submission.rb#L1265
I believe this could result in a memory leak.
Added an explicit rescue
clause that calls csv_writer.close
if an exception occurs. This has fixed the issue.
fixed
I see sporadic Zlib::GzipWriter errors that appear during test runs. You can reproduce it by running the test_ontology_submission.rb tests:
The full error output is:
Example: