Skip to content
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

3.1.0-rc1 Ruby bindings on Windows sql parse segfaults #4109

Closed
tijcolem opened this issue Oct 6, 2020 · 5 comments · Fixed by #4115
Closed

3.1.0-rc1 Ruby bindings on Windows sql parse segfaults #4109

tijcolem opened this issue Oct 6, 2020 · 5 comments · Fixed by #4115

Comments

@tijcolem
Copy link
Collaborator

tijcolem commented Oct 6, 2020

This issue originated and discovered by @mdahlhausen. See the issue/problem below.


Using ruby bindings on Windows segfaults when parsing eplusout.sql results file.

Expected Behavior

It should parse the eplusout.sql or fail gracefully if the eplusout.sql file is corrupt and/or returning incorrect info (e.g. bad query).

Steps to Reproduce

Using openstudio 3.1.0-rc1](https://github.com/NREL/OpenStudio/releases/tag/v3.1.0-rc1) run the following script using ruby bindings. See attached eplusout.zip (unzip first).

require 'openstudio'
model = OpenStudio::Model::Model.new()
sql_fle_path = "#{File.dirname(__FILE__)}/eplusout.sql"
sql_file = OpenStudio::SqlFile.new(OpenStudio::Path.new(sql_fle_path))
model.setSqlFile(sql_file)
error_query = "SELECT ErrorMessage FROM Errors WHERE ErrorType in(1,2)"
errs = model.sqlFile.get.execAndReturnVectorOfString(error_query)

eplusout.zip

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

@tijcolem tijcolem added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Oct 6, 2020
@mdahlhausen
Copy link
Collaborator

To generalize this, any call to get a string from the sql file fails
execAndReturnFirstString and execAndReturnVectorOfString methods

# load sql as per the comment above
sql = model.sqlFile.get
string_query = "SELECT EnvironmentName FROM EnvironmentPeriods"
strings = sql.execAndReturnFirstString(string_query)

@lefticus
Copy link
Contributor

lefticus commented Oct 7, 2020

@tijcolem I created a PR #4115 to address this.

I only tested on Windows so far, I'll kick off a sanity check on Linux right now.

@tijcolem
Copy link
Collaborator Author

tijcolem commented Oct 8, 2020

Thanks @lefticus! I'll get a build going and we'll do some internal testing. This is great.

@lefticus
Copy link
Contributor

lefticus commented Oct 8, 2020

Linux looked good from my perspective.

@tijcolem
Copy link
Collaborator Author

tijcolem commented Oct 8, 2020

Yep, Windows, Linux and mac all look good. Just doing some internal testing here to confirm and then we'll get this merged in.

@tijcolem tijcolem added component - Ruby bindings severity - Major Bug and removed Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Oct 8, 2020
@tijcolem tijcolem added this to the OpenStudio SDK 3.1.0 milestone Oct 8, 2020
@kbenne kbenne mentioned this issue Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants