Maximum attribute size limit (524288) exceeded at DiagnosticReport/PresentedForm

2,860 views
Skip to first unread message

Nikos Kyriakoulakos

unread,
Jun 2, 2015, 9:00:48 AM6/2/15
to hapi...@googlegroups.com
Hi to all,

I am trying to send a DiagnosticReport with a 2MB attachment as base64 encoding at PresentedForm Data. When I execute :

MethodOutcome modr = genericClient.create().resource(newdiagnosticreport).execute() ;

I get :

Exception in thread "main" ca.uhn.fhir.rest.server.exceptions.InternalErrorException: HTTP 500 Server Error: javax.xml.stream.XMLStreamException: Maximum attribute size limit (524288) exceeded
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException.newInstance(BaseServerResponseException.java:254)
at ca.uhn.fhir.rest.client.BaseClient.invokeClient(BaseClient.java:272)
at ca.uhn.fhir.rest.client.GenericClient$BaseClientExecutable.invoke(GenericClient.java:579)
at ca.uhn.fhir.rest.client.GenericClient$CreateInternal.execute(GenericClient.java:683)
at ca.uhn.fhir.rest.client.GenericClient$CreateInternal.execute(GenericClient.java:630)
at com.mycompany.api.client.Client.main(Client.java:458)

The same code is working perfect for attachments smaller than 512K.

Hapi Fhir v1.0

Thanks in advance,
Nick



James Agnew

unread,
Jun 2, 2015, 11:52:04 AM6/2/15
to Nikos Kyriakoulakos, hapi...@googlegroups.com
Hi Nikos,

Any size limitations are definitely coming from the server you're sending to and not the client.

Is this targeting a public server, or one you are hosting yourself? Most of the public servers including our own have size limitations which are reasonably small in order to prevent abuse. If it's a server you're hosting yourself, is it also HAPI? If so, which container are you using?

Cheers,
James

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To post to this group, send email to hapi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/05109aed-da6d-4b51-8dfd-92ba261bf298%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Nikos Kyriakoulakos

unread,
Jun 2, 2015, 1:56:05 PM6/2/15
to hapi...@googlegroups.com, kyri...@gmail.com
Hi James,

I am using eclipse (luna) jetty during development, so I must figure out how to configure it, but I can't find what attribute must set to higher value (some candidates are outputBufferSize, responseHeaderSize)

Thank you,
Nikos

Bill de Beaubien

unread,
Jun 3, 2015, 9:20:01 AM6/3/15
to Nikos Kyriakoulakos, hapi...@googlegroups.com
What James is saying is that because you got a 500 error back, the actual problem is on the server side, not the client side. The client successfully sent the create resource, then the FHIR server on the other end said "I can't decode this XML because the attribute is longer than I can deal with". Which server were you posting the resource to? Also, do you have a more complete stack trace including the inner exceptions, or did that not come back in the response from the server? To me, this looks like an error in the "generic" XML parsing code on the server; I'm not sure whether things like maximum attribute length are configurable there or not (a quick google search didn't turn up anything, nor was I able to find anywhere that says there's a limit on attribute length in the XML parser...)

Bill

Nikos Kyriakoulakos

unread,
Jun 4, 2015, 6:35:41 AM6/4/15
to hapi...@googlegroups.com, kyri...@gmail.com
The server is the HAPI v1.0 server running on embedded Jetty to Eclipse as a Maven project, there is no other stack trace or inner exceptions. I will try to deploy it to normal Jetty installation.

Nikos

James Agnew

unread,
Jun 4, 2015, 3:07:44 PM6/4/15
to Nikos Kyriakoulakos, hapi...@googlegroups.com
Hi Nikos,

I tried to reproduce this, and to my surprise it turns out that it's actually not Jetty after all. It looks like Woodstox (the XML parsing library we use in HAPI) has a default maximum length for a single attribute of 512kb. I am a bit baffled as to why they would have that, but fortunately it is easy to disable.

I've just committed a fix, and pushed a new 1.1-SNAPSHOT build with that fix in. If you are working from source, a git pull should fix this.

Thanks for reporting!

Cheers,
James


Nikos Kyriakoulakos

unread,
Jun 12, 2015, 6:49:23 AM6/12/15
to hapi...@googlegroups.com, kyri...@gmail.com
Thank you James, 

Excellent work !!!
 
I will test it also and let you know for any additional problem.

Nikos

chikkala...@gmail.com

unread,
Mar 1, 2017, 4:26:03 PM3/1/17
to HAPI FHIR, kyri...@gmail.com
Hi,

  I ran into same issue. Can you kindly explain how you disabled that 512kb limitation.

Thanks
Ravi

James Agnew

unread,
Mar 1, 2017, 4:33:19 PM3/1/17
to chikkala...@gmail.com, HAPI FHIR, Nikos Kyriakoulakos
Apparently the fix did not actually fix the issue on some platforms.

There is an open pull request which corrects this: https://github.com/jamesagnew/hapi-fhir/pull/571

It should be merged in the next day or so.. If you're able to test that would be awesome.

Cheers,
James

To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+unsubscribe@googlegroups.com.

To post to this group, send email to hapi...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages