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

Performing GET on a non-empty [api-x] 'services' indirect container results in 500 #77

Open
emetsger opened this issue Nov 3, 2016 · 4 comments

Comments

@emetsger
Copy link
Contributor

emetsger commented Nov 3, 2016

To reproduce:

  1. bring up api-x milestone
  2. GET the services container (/fcrepo/apix/services)
  3. put a resource in the container
  4. GET the services container (HEAD will work, but GET does not)

Similar behavior using either Fedora 4.6.0 or 4.7.0 in the 'fcrepo' container.

HTTP/1.1 500 Server Error
Content-Type: text/turtle
Accept: /
Accept-Patch: application/sparql-update
Accept-Post: text/turtle,text/rdf+n3,text/n3,application/rdf+xml,application/n-triples,multipart/form-data,application/sparql-update
Allow: MOVE,COPY,DELETE,POST,HEAD,GET,PUT,PATCH,OPTIONS
breadcrumbId: ID-9039a37c0da5-41693-1478206589033-2-200
ETag: W/"85a2b321e51df70cfa3b5706b4b8b1446998cf00"
Last-Modified: Thu, 03 Nov 2016 21:08:28 GMT
Link: http://www.w3.org/ns/ldp#Container;rel="type"
Link: http://www.w3.org/ns/ldp#IndirectContainer;rel="type"
Link: http://www.w3.org/ns/ldp#Resource;rel="type"
Link: http://192.168.99.100/discovery/apix/indirect4; rel="service"
Preference-Applied: return=representation
Server: Jetty(9.2.3.v20140905)
Vary: Prefer
Vary: Accept, Range, Accept-Encoding, Accept-Language
Transfer-Encoding: chunked

java.lang.NullPointerException
at com.google.common.collect.ImmutableBiMap.copyOf(ImmutableBiMap.java:201)
at org.fcrepo.kernel.modeshape.rdf.converters.PropertyConverter.getPropertyNameFromPredicate(PropertyConverter.java:148)
at org.fcrepo.kernel.modeshape.rdf.converters.PropertyConverter.getPropertyNameFromPredicate(PropertyConverter.java:102)
at org.fcrepo.kernel.modeshape.rdf.impl.LdpContainerRdfContext.lambda$memberRelations$108(LdpContainerRdfContext.java:131)
at org.fcrepo.kernel.modeshape.utils.UncheckedFunction.apply(UncheckedFunction.java:37)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267)
at java.util.stream.Streams$StreamBuilderImpl.forEachRemaining(Streams.java:419)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Iterator.forEachRemaining(Iterator.java:116)
at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.Spliterators$IteratorSpliterator.tryAdvance(Spliterators.java:1812)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:728)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:731)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:728)
at java.util.stream.Streams$ConcatSpliterator.tryAdvance(Streams.java:735)
at java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:294)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206)
at java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:169)
at java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:300)
at java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681)
at org.openrdf.rio.Rio.write(Rio.java:564)
at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput.write(RdfStreamStreamingOutput.java:150)
at org.fcrepo.http.commons.responses.RdfStreamStreamingOutput.write(RdfStreamStreamingOutput.java:118)
at org.fcrepo.http.commons.responses.RdfStreamProvider.writeTo(RdfStreamProvider.java:102)
at org.fcrepo.http.commons.responses.RdfStreamProvider.writeTo(RdfStreamProvider.java:58)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.JsonWithPaddingInterceptor.aroundWriteTo(JsonWithPaddingInterceptor.java:106)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.server.internal.MappableExceptionWrapperInterceptor.aroundWriteTo(MappableExceptionWrapperInterceptor.java:86)
at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162)
at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130)
at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:711)
at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:769)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1125)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1059)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
at org.eclipse.jetty.server.Server.handle(Server.java:497)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:248)
at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:610)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:539)
at java.lang.Thread.run(Thread.java:745)
esm:~/workspaces/apix/repository-extension-services/acrepo-exts-image/src/main/resources (master)*$

@emetsger emetsger added this to the Milestone + Demo 1 milestone Nov 3, 2016
@birkland
Copy link
Contributor

birkland commented Nov 3, 2016

That's originating from Fedora; not good

@emetsger
Copy link
Contributor Author

emetsger commented Nov 3, 2016

It'd be helpful if you can verify; I can take a dive tonight.

@birkland
Copy link
Contributor

birkland commented Nov 3, 2016

Will do, later tonight or tomorrow!

@emetsger
Copy link
Contributor Author

emetsger commented Nov 4, 2016

@birkland and I confirm that this occurs when not including an ore:describes triple in the resources deposited to the indirect container. Hypothesis is that including the ore namespace definition in fedora-note-types.cnd will fix the issue.

Since we have workarounds (e.g. not having the user of the Milestone directly interact with the 'services' indirect container), untagging this issue for the Milestone, and will submit a patch to Fedora after.

@emetsger emetsger removed this from the Milestone + Demo 1 milestone Nov 4, 2016
emetsger added a commit to emetsger/fcrepo-api-x that referenced this issue Nov 10, 2016
…g http4 instead. This problem manifests itself when API-X proxies the retrieval of large (>2MiB) resources from Fedora. (fcrepo4-labs#77)

- Use http4 component instead of jetty in the 'execute-intercept' route
- Includes IT demonstrating the issue whe the jetty component is used
emetsger pushed a commit to emetsger/fcrepo-api-x that referenced this issue Nov 14, 2016
http requests to endpoints; it relies on an easily-exceeded 2MB buffer.

The http4 component supports streaming out of the box, but Exchanges
that originate from http requests automatically close streams when their
lifecycle ends. This means that certain Camel constructs that terminate
exchanges (e.g. recipientList, enrich, etc) must be avoided. This is an
undocumented gotcha in Camel.

Resolves fcrepo4-labs#76

Squashed commit of the following:

commit f2c7250bb1545be7aeb171d504340d2af7795482
Author: Aaron Birkland <[email protected]>
Date:   Sat Nov 12 23:28:40 2016 -0500

    Refactor intercept routes for streaming

    Http-based exchanges in streaming mode automatically close their
    connections after theexchange is done.  As the "loop" and
    "enhance" nodes result in the termination of exchanges, the
    ssubsequent closing of the stream results in "attempt to read
    from closed stream" exceptions

commit be18a35d271d6fe2d7640c57eb168257bb1cc53d
Author: Aaron Birkland <[email protected]>
Date:   Thu Nov 10 19:24:16 2016 -0500

    Complete conversion to http4

commit c665825763bd060681e3fd5222d22d6daab74a9b
Author: Aaron Birkland <[email protected]>
Date:   Thu Nov 10 16:34:51 2016 -0500

    checkstyle

commit 5023908
Author: Elliot Metsger <[email protected]>
Date:   Wed Nov 9 11:36:26 2016 -0500

    Work around limitations with buffering in the jetty component by using http4 instead.  This problem manifests itself when API-X proxies the retrieval of large (>2MiB) resources from Fedora. (fcrepo4-labs#77)
    - Use http4 component instead of jetty in the 'execute-intercept' route
    - Includes IT demonstrating the issue whe the jetty component is used
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

No branches or pull requests

2 participants