Skip to content
This repository was archived by the owner on Apr 16, 2022. It is now read-only.

On export, skip submissions that can't be parsed #884

Merged
merged 2 commits into from
Oct 28, 2020

Conversation

lognaturel
Copy link
Member

Closes #874

What has been done to verify that this works as intended?

Tried different exports with and without empty submission.xml files. Clearing the contents of a submission.xml file reproduces the original issue. With this PR, the export should be successful, there should be a message in the details saying Can't export submission ..., the -errors folder should include the failed submission with its instanceID.

Why is this the best possible solution? Were any other approaches considered?

This is the only solution I considered once I realized that submissions that were leading to parse errors were included in the submissions to export. This is the simplest way to exclude those submissions.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Users should get fewer export errors and should have more information to recover from them when they do happen. The regression risk is low because it only affects the path where there's an exception on parse.

Does this change require updates to documentation? If so, please file an issue at https://github.com/getodk/docs/issues/new and include the link below.

No.

@codecov-io
Copy link

Codecov Report

Merging #884 into master will decrease coverage by 0.01%.
The diff coverage is 45.45%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #884      +/-   ##
============================================
- Coverage     48.33%   48.32%   -0.02%     
+ Complexity     1647     1646       -1     
============================================
  Files           195      195              
  Lines         10422    10418       -4     
  Branches        753      752       -1     
============================================
- Hits           5037     5034       -3     
+ Misses         5026     5024       -2     
- Partials        359      360       +1     
Impacted Files Coverage Δ Complexity Δ
.../org/opendatakit/briefcase/export/ExportToCsv.java 68.62% <0.00%> (-0.61%) 11.00 <0.00> (ø)
...opendatakit/briefcase/export/SubmissionParser.java 73.40% <50.00%> (+2.27%) 24.00 <2.00> (ø)
...g/opendatakit/briefcase/reused/UncheckedFiles.java 44.53% <0.00%> (-1.69%) 31.00% <0.00%> (-1.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b55a171...308f844. Read the comment docs.

@lognaturel
Copy link
Member Author

@getodk/testers I've rebased on master, please take a look.

@kkrawczyk123
Copy link
Contributor

@lognaturel After long investigation we finally figure out the problem and agreed that the export crash issue is visible on PR's build only on java 8. I was also able to reproduce it (I am normally on java 11 this is why it wasn't visible for me previously), see the gif:
Peek 2020-10-28 11-54

The issue is not visible on java 9, 10 and 11. I am not sure which one is the most frequent for users. As the issue is visible only on the old java version it shouldn't block this or. It has been verified on Ubuntu and MacOS.

Here comes a question on which java version we should do regression pass?
In the last release, I was using java 11 for building and testing. There are also cases to run briefcase on java 8, 9 and 10 and perform basic actions like pull, push and export.

@getodk-bot unlabel "needs testing"
@getodk-bot label "behavior verified"

@lognaturel
Copy link
Member Author

We build releases with Java 11 and we don't typically support users making their own builds. So if it's the build version that makes a difference, I don't think it matters. If it's the run version that makes a difference, then I think we should look into it more deeply.

Java 11 from https://adoptopenjdk.net/ is what we recommend in the docs for running Briefcase so let's QA with that. Still, it should run with Java 8.

@kkrawczyk123
Copy link
Contributor

It's a run version issue, jar has been build on java 11.

@lognaturel
Copy link
Member Author

Got it, so I will look into it. It's specifically linked to this PR? And the export just hangs?

@lognaturel
Copy link
Member Author

I'll merge and then investigate on master. I'm guessing that somewhere there's an API not available on Java 8 that's being used but I don't think it's in this PR specifically.

@lognaturel lognaturel merged commit fbd9fd3 into getodk:master Oct 28, 2020
@lognaturel lognaturel deleted the issue-874 branch October 28, 2020 16:35
@kkrawczyk123
Copy link
Contributor

It works better on 1.17.4 where export is starting, % progress is displayed and csv is created but it's empty and shows exactly the issue that has been fixed here.

@lognaturel
Copy link
Member Author

I just merged, pulled from master, built with java 11, ran with java oracle64-1.8.0.202, and everything worked as expected. If you're seeing a crash, do you get a stack trace on the console?

@kkrawczyk123
Copy link
Contributor

Actually what is even weirder nothing meaningful seems to show in log: briefcase .log.txt
I wasn't able to reproduce for Central, Aggregate only.

@mmarciniak90
Copy link

console.txt
export

@lognaturel
Copy link
Member Author

@mmarciniak90 the server source makes no difference, right? You have that strange thing where forms aren’t immediately showing up in push or export after a pull. Is that also the case on v1.17.4? And can you confirm everything works as expected when you use Java 11?

@mmarciniak90
Copy link

the server source makes no difference, right?

That's right. I was able to reproduce it on the Aggregate server and Central, as you can see.

You have that strange thing where forms aren’t immediately showing up in push or export after a pull. Is that also the case on v1.17.4?

Yes, when I'm using Java 8.

And can you confirm everything works as expected when you use Java 11?

When I use Java 11 I don't see problem where forms aren’t immediately showing up in push or export after a pull.

@lognaturel
Copy link
Member Author

lognaturel commented Oct 29, 2020

I don't see problem where forms aren’t immediately showing up in push or export after a pull.

Great. And what about on 1.17.4? Do the forms show up immediately?

Does export work as expected with Java 11?

Another thought for Java 8. What if you pull, close Briefcase, reopen Briefcase then try the export?

@mmarciniak90
Copy link

And what about on 1.17.4? Do the forms show up immediately?
Does export work as expected with Java 11?

When I use Java 11 and Briefcase with these changes,

  • forms are immediately showing up in push or export after a pull
  • no crash on export when submission is empty
  • details status shows correct information
    Screenshot from 2020-10-29 16-46-01

When I use Java 11 and Briefcase 1.17.4

  • forms are immediately showing up in push or export after a pull
  • crash on export when submission is empty
    • Caused by: java.lang.RuntimeException: Document has no root element!

What if you pull, close Briefcase, reopen Briefcase then try the export?

When I use Java 8 and Briefcase with these changes,

  • forms aren’t immediately showing up in push or export after a pull (also visible on 1.17.4)
  • closing Briefcase and reopening it doesn't cause that forms are showing up in push or export. Only reloading the storage directory fixes this issue.

When I use Java 8 and Briefcase 1.17.4

  • forms aren’t immediately showing up in push or export after a pull (also visible on 1.17.4)
  • closing Briefcase and reopening it doesn't cause that forms are showing up in push or export. Only reloading the storage directory fixes this issue.

@lognaturel
Copy link
Member Author

Great, so we don't worry about forms showing up in the other tabs since that's an ongoing issue.

closing Briefcase and reopening it doesn't cause that forms are showing up in push or export. Only reloading the storage directory fixes this issue.

And when you reload after re-opening on this PR, does the export work or does it still hang/crash? Does it hang for all forms or only forms with empty submissions?

@mmarciniak90
Copy link

mmarciniak90 commented Oct 29, 2020

Yeah!! We have a workaround! 🎉
Reopen and reload storage directory cause that export is possible with Java 8.
Finally, I have the expected status.
Screenshot from 2020-10-29 17-19-58

@lognaturel
Copy link
Member Author

Phew! Ok, so the problem you experience is that on Java 8, if there is an empty submission, export fails unless Briefcase is closed and reopened? Export works in other cases, right? I think that means we're no worse off than with v1.17.4 so we can file this as an issue and deal with it if users run into trouble.

@mmarciniak90
Copy link

I completely agree!

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash on export when submission is empty
5 participants