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

Summary restart load fix #305

Closed

Conversation

joakim-hove
Copy link
Contributor

@joakim-hove joakim-hove commented Jan 29, 2018

Task
Bug when loading a restarted summary case when the restarted source was given as an absolute path.

The first commit is the fix.

The two middle commits are test refactoring, the last commit is a test of the fix.

NB: This fix unearthed another bug/problem which comes in the Statoil testdata. That problem is fixed here: #319.

@joakim-hove joakim-hove force-pushed the summary-restart-load-fix branch 2 times, most recently from 252129f to 754f04c Compare January 29, 2018 20:42
@joakim-hove joakim-hove changed the title WIP: Summary restart load fix Summary restart load fix Jan 29, 2018
@joakim-hove joakim-hove force-pushed the summary-restart-load-fix branch 7 times, most recently from 8a3cfe4 to 3ba55aa Compare February 2, 2018 11:28
with pushd("subdir"):
prediction = create_case( case = "PREDICTION", restart_case = restart_case, data_start = history.end_date)
prediction.fwrite()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to explain what you are thinking here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was to reproduce / test a reasonably contrived bug. Have added documentation describing the situation which used to fail.

Copy link
Contributor

@pgdr pgdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is scope() for?

The loading of a restarted case was wrong in the summary loader when the
restarted case was given as an absolute pathname.
@joakim-hove
Copy link
Contributor Author

What is scope() for?

Weird construction - removed; better implemented with a function.

@markusdregi
Copy link
Contributor

I'm working on this in-between other things, so the pace is not exactly hyper speed. But, I can confirm that I reproduce the exact same failure locally on my machine. I'll start digging now..

@markusdregi
Copy link
Contributor

It is test_restart_abs_path test that fails heavily.

Here (https://github.com/joakim-hove/libecl/blob/67e9bebe925631086743c06491bf68c94124bb01/lib/ecl/ecl_smspec.c#L508) restart_case is the file named HISTORY, but as an absolute path. Which makes we think that that line is not comparing what it should be comparing. It returns a NULL-pointer, letting all kind of monsters out of the box when createEclSum is adding the variables.

I'm expecting that the reason it kicks in now is because you are interpreting the paths now as absolute paths. And that it kicks in only on macOS because the prefix of any tmp-path is longer on macOS then on linux.

I hope that helps ;)

@joakim-hove
Copy link
Contributor Author

It is test_restart_abs_path test that fails heavily.

Thank you - hopefully I can take it from here.

@markusdregi
Copy link
Contributor

No problem. If you just enforce the path in the test to be more than 64 characters long it should burn on your machine as well.. If you do not figure it out, we can discuss it further in Thursday :)

@joakim-hove
Copy link
Contributor Author

Thank you - this is a semi-old bug which was unearthed now.

It returns a NULL-pointer, letting all kind of monsters out of the box when createEclSum is adding the variables.

It should be:

if (restart_case) {
    if (strlen(restart_case) <= (SUMMARY_RESTART_SIZE * ECL_STRING8_LENGTH))
      ecl_smspec->restart_case = util_alloc_string_copy( restart_case );
}

i.e. nothing should be done if the test fails - that is actually semi-ok.

@joakim-hove
Copy link
Contributor Author

OK @pgdr - I have tried to address your comments and now this green on Travis - further comments?

Copy link
Contributor

@pgdr pgdr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No further comments, good work!

@joakim-hove
Copy link
Contributor Author

#319 has been rebased on top of this - they need to be merged together. Closing this

@joakim-hove joakim-hove closed this Feb 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants