The smooks parser goes into infinite loop on passing syntaxIdentifier which is not mentioned in xsd

80 views
Skip to first unread message

Reshma Kumari

unread,
Feb 21, 2024, 12:43:47 PMFeb 21
to Smooks Users
Hi smooks users,
I am trying to parse following EDI text with syntaxIdentifier value as KECA and syntaxVersion as 1. 

UNB+KECA:1+QW:KL+FT:KL+240216:1347+20240216134624'UNH+1+APERAK:D:00A:UN'BGM+294+cgch++1'DTM+137:202402161346:203'DOC+938:::VATDEC'RFF+ACE:cgch'RFF+wd:1'RFF+ws:E'NAD+MS+we'NAD+MR+wd'ERC+ER:E'FTX+AAP+++cgch:(30¿.():'UNT+12+1'UNZ+1+20240216134624'

The parser get stuck into infinite loop showing following error: o.s.cartridges.dfdl.parser.DfdlParser    : Parse Error: Initiator 'UNB' not found
Schema context: UNB Location line 41 column 18 in .../79fhtzkj5hn6b9ysd7tnpb840000gp/T/3600218453299886676/EDIFACT-Interchange-b3a0e203-3bc4-38a0-8862-3630bd0a2d55.dfdl.xsd
Data location was preceding byte 62
Any leads? How can i prevent smooks from entering into infinite loop apart from the validation check for the syntaxIdentifier and syntaxVersion.
Also, why its working for syntaxIdentifier value as KECA and syntaxVersion as 4. I can see in the EDIFACT-Service-Segments-4.1.dfdl.xsd that the SyntaxIdentifier does not have KECA.

Reshma Kumari

unread,
Feb 21, 2024, 1:34:45 PMFeb 21
to Smooks Users
I referred the xsd for D00A and found that the supported versions are only 3 and 4. This explains why the conversion happened for version 4 and not for 1. But is there some way that i can still convert above EDI having syntax version as 1.
How can i prevent smooks from entering into infinite loop.

Claude Mamo

unread,
Feb 24, 2024, 6:54:55 AMFeb 24
to smook...@googlegroups.com

How can i prevent smooks from entering into infinite loop.

I'd say that the infinite loop error is unexpected even though only syntax versions 3 and 4 are supported. edifact:parser should give up when encountering a fatal error instead of attempting to process the next chunk of data. This behaviour is probably a regression caused by the fix to #241 . When validationMode is Off, the default setting, edifact:parser prints the error and tries to continue parsing but this is causing an infinite loop in some cases. I'll create an issue for this. Setting validationMode to Full will cause edifact:parser to abort and bubble up the exception (note: Full validation disables streaming).

But is there some way that i can still convert above EDI having syntax version as 1.

I can look into supporting other sytax versions since this has already been requested by other users. In the meantime, the recommendation has been so far to override the EDIFACT schema . I think it could be enough to remove the syntax version assertion from the Interchange schema but I don't know what unintended side-effects removing the assertion might have (the particluar schema is a Mustache template so you'd need to replace the tags if you're going to override the Interchange schema).

Claude

--
You received this message because you are subscribed to the Google Groups "Smooks Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to smooks-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/smooks-user/1c985f80-e696-44c7-acfb-ad721e2e947fn%40googlegroups.com.

Claude

unread,
Mar 13, 2024, 6:27:22 AMMar 13
to Smooks Users
I've created a GitHub issue for the infinite error loop problem: https://github.com/smooks/smooks-dfdl-cartridge/issues/191 .

Claude

Steven Hofman

unread,
Apr 10, 2024, 4:44:45 AMApr 10
to Smooks Users

Hi Claude,

We have the exact same problem with older unsupported versions of the UNB headers causing infinite loops. I'm really glad to see you have already been working on a fix for this.
I see the fix is added to the v1.0.0-RC4 milestone. The latest release is still v1.0.0-RC3. Is there any planned time when v1.0.0-RC4 would be released?

Thanks so much for your support.

Br,
Steven
Op woensdag 13 maart 2024 om 11:27:22 UTC+1 schreef Claude:

Claude

unread,
Apr 18, 2024, 4:22:02 AMApr 18
to Smooks Users
2.0.0-RC4 umbrella release has just been announced: https://groups.google.com/g/smooks-user/c/JhplstPZrqo
Reply all
Reply to author
Forward
0 new messages