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

SUSHI output line too long for MySushiHandler #712

Closed
qligier opened this issue Jun 21, 2023 · 1 comment
Closed

SUSHI output line too long for MySushiHandler #712

qligier opened this issue Jun 21, 2023 · 1 comment

Comments

@qligier
Copy link
Contributor

qligier commented Jun 21, 2023

I'm using SUSHI 3 and the IG Publisher 1.3.18.

When building the IG ch-epr-mhealth (https://github.com/ehealthsuisse/ch-epr-mhealth), the IG Publisher hangs while running SUSHI.

Output logs when running SUSHI:

Quentin >_ sushi build .
info  Running SUSHI v3.0.0 (implements FHIR Shorthand specification v2.0.0)
info  Arguments:
info    D:\Programmation\FHIR\ch-epr-mhealth
info  No output path specified. Output to .
info  Extracting FSHOnly configuration from input\ch.fhir.ig.ch-epr-mhealth.xml...
info  Extracted configuration:
info    id: "ch.fhir.ig.ch-epr-mhealth"
info    canonical: "http://fhir.ch/ig/ch-epr-mhealth"
info    url: "http://fhir.ch/ig/ch-epr-mhealth/ImplementationGuide/ch.fhir.ig.ch-epr-mhealth"
info    name: "CHEprMhealth"
info    packageId: "ch.fhir.ig.ch-epr-mhealth"
info    version: "3.0.0-ballot"
info    status: "active"
info    fhirVersion[0]: "4.0.1"
info    dependencies[0]: {"id":"chcore","uri":"http://fhir.ch/ig/ch-core/ImplementationGuide/ch.fhir.ig.ch-core","packageId":"ch.fhir.ig.ch-core","version":"current","fhir_comments":["<dependsOn id=\"chterm\">\r\n    <uri value=\"http://fhir.ch/ig/ch-epr-term/ImplementationGuide/ch.fhir.ig.ch-epr-term\"/>\r\n    <packageId value=\"ch.fhir.ig.ch-epr-term\"/>\r\n    <version value=\"2.0.x\"/>\r\n  </dependsOn>"]}
[it continues...]

Output logs when running the IG Publisher:

Run Sushi on D:\Programmation\FHIR\ch-epr-mhealth                                (00:00.071)
Sushi: info  Running SUSHI v3.0.0 (implements FHIR Shorthand specification v2.0.0) (00:27.356)
Sushi: info  Arguments:                                      (00:28.226)
Sushi: info    --out D:\Programmation\FHIR\ch-epr-mhealth    (00:29.635)
Sushi: info    D:\Programmation\FHIR\ch-epr-mhealth          (00:33.717)
Sushi: info  Extracting FSHOnly configuration from input\ch.fhir.ig.ch-epr-mhealth.xml... (00:34.441)
Sushi: info  Extracted configuration:                        (00:34.968)
Sushi: info    id: "ch.fhir.ig.ch-epr-mhealth"               (00:36.406)
Sushi: info    canonical: "http://fhir.ch/ig/ch-epr-mhealth" (00:38.466)
Sushi: info    url: "http://fhir.ch/ig/ch-epr-mhealth/ImplementationGuide/ch.fhir.ig.ch-epr-mhealth" (00:49.318)
Sushi: info    name: "CHEprMhealth"                          (00:51.909)
Sushi: info    packageId: "ch.fhir.ig.ch-epr-mhealth"        (00:53.546)
Sushi: info    version: "3.0.0-ballot"                       (00:54.743)
Sushi: info    status: "active"                              (00:56.319)
Sushi: info    fhirVersion[0]: "4.0.1"                       (01:01.900)
[it hangs here]

The IG Publisher hangs after 'fhirVersion[0]: "4.0.1"' because the long output line goes through MySushiHandler, which only has a 256 bytes buffer, while the line is 414 characters long. It throws an IndexOutOfBoundsException, which seems not to be properly caught by the PumpStreamHandler or Executor.

dotasek added a commit that referenced this issue Jun 29, 2023
* Improve the SUSHI output String buffer

It now automatically increases size if the current SUSHI output line is larger than the buffer initial size, preventing an IndexOutOfBoundsException being thrown. The StringBuilder is reused in the same way the old byte array was. to preserve performance. It solves #712.

* Make FSHRunner.MySushiHandler static

* Use a string consumer in FSHRunner.MySushiHandler

* Add tests for FSHRunner

* Break tests into distinct cases + test error parse

---------

Co-authored-by: dotasek <[email protected]>
Co-authored-by: dotasek <[email protected]>
@qligier
Copy link
Contributor Author

qligier commented Jun 29, 2023

Fixed in #713.

@qligier qligier closed this as completed Jun 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

1 participant