NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
494 stars 188 forks source link

/tmp/xmlvalidation directories #5076

Closed brianlball closed 7 months ago

brianlball commented 7 months ago

Issue overview

Ubuntu; /tmp is getting filled up with xmlvalidation directories

Current Behavior

/tmp/xmlvalidation directories and measure_v3.0.xsd files are not getting cleaned up

Expected Behavior

would like those files to get deleted.

Steps to Reproduce

This occurs in large quantities in OSAF runs, but I think any CLI run will reproduce.

Environment

Ubuntu 22, OS 3.6.1

Context

OSAF runs

brianlball commented 7 months ago

https://github.com/NREL/OpenStudio/issues/4761

jmarrec commented 7 months ago

Can you please make sure these aren't leftovers from previous versions? Because I can't reproduce on Ubuntu with 3.7.0 or even down to 3.5.1.

Can you try this one liner test please? RUnning at root of this repo, otherwise just change the path pointing to an .xml schema (schematron)

dir=$(/usr/local/openstudio-3.7.0/bin/openstudio -e 'v = OpenStudio::XMLValidator.new("resources/utilities/xml/schema/HPXMLvalidator.xml"); tmp_dir = v.schemaPath.parent_path.to_s; files = Dir.glob("#{tmp_dir}/*"); puts tmp_dir; STDERR.puts "files: #{files}"'); [ -d "$dir" ] && echo "NOT OK: $dir is not deleted" || echo "OK, $dir is deleted"

3.5.0 and below did have the issue:

$ dir=$(/usr/local/openstudio-3.5.0/bin/openstudio -e 'v = OpenStudio::XMLValidator.new("resources/utilities/xml/schema/HPXMLvalidator.xml"); tmp_dir = v.schemaPath.parent_path.to_s; files = Dir.glob("#{tmp_dir}/*"); puts tmp_dir; STDERR.puts "files: #{files}"'); ls $dir && echo "NOT OK: $dir is not deleted" || echo "OK, $dir is deleted"
files: ["/tmp/xmlvalidation-1705307359-0/iso_svrl_for_xslt1.xsl", "/tmp/xmlvalidation-1705307359-0/HPXMLvalidator_stylesheet.xslt", "/tmp/xmlvalidation-1705307359-0/iso_schematron_skeleton_for_xslt1.xsl"]
HPXMLvalidator_stylesheet.xslt  iso_schematron_skeleton_for_xslt1.xsl  iso_svrl_for_xslt1.xsl
NOT OK: /tmp/xmlvalidation-1705307359-0 is not deleted
jmarrec commented 7 months ago

Ok got it... It's BCLXML that calls XMLValidator::bclXMLValidator which creates a tmp dir and never cleans it

https://github.com/NREL/OpenStudio/blob/ecdc6363b736f37ecbe8983fa56c719a5e1a77b0/src/utilities/bcl/BCLXML.cpp#L79-L83

https://github.com/NREL/OpenStudio/blob/ecdc6363b736f37ecbe8983fa56c719a5e1a77b0/src/utilities/xml/XMLValidator.cpp#L484-L489

Same issue for gbxmlValidator

jmarrec commented 7 months ago

Udpated one-liner test, which does fail:

dir=$(openstudio -e 'v = OpenStudio::XMLValidator::bclXMLValidator(OpenStudio::BCLXMLType.new("MeasureXML"), OpenStudio::VersionString.new("3.1")); tmp_dir = v.schemaPath.parent_path.to_s; files = Dir.glob("#{tmp_dir}/*"); puts tmp_dir; STDERR.puts "files: #{files}"'); [ -d "$dir" ] && echo "NOT OK: $dir is not deleted" || echo "OK, $dir is deleted"