buda-base / lds-pdi

http://purl.bdrc.io BDRC Linked Data Server
Apache License 2.0
2 stars 0 forks source link

strange error making the website hang #194

Closed eroux closed 4 years ago

eroux commented 4 years ago

This page gives the erroneous output:

{"aux":{

which makes the site hang, and this error appears in the ldspdi.log file:

[2020-08-09 15:01:49,828 ERROR] cat].[localhost].[/].[dispatcherServlet]: 175 [http-nio-13280-exec-16] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception
com.fasterxml.jackson.databind.JsonMappingException: Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: java.util.HashMap["aux"]->java.util.HashMap["null"])
    at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:285)
    at com.fasterxml.jackson.databind.SerializerProvider.mappingException(SerializerProvider.java:1251)
    at com.fasterxml.jackson.databind.SerializerProvider.reportMappingProblem(SerializerProvider.java:1145)
    at com.fasterxml.jackson.databind.ser.impl.FailingSerializer.serialize(FailingSerializer.java:35)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:705)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:643)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:33)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:722)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:643)
    at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:33)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:480)
    at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:319)
    at com.fasterxml.jackson.databind.ObjectMapper._configAndWriteValue(ObjectMapper.java:3906)
    at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3177)
    at io.bdrc.libraries.StreamingHelpers$4.writeTo(StreamingHelpers.java:97)
    at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBodyReturnValueHandler$StreamingResponseBodyTask.call(StreamingResponseBodyReturnValueHandler.java:97)
    at org.springframework.web.context.request.async.WebAsyncManager.lambda$startCallableProcessing$4(WebAsyncManager.java:327)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[2020-08-09 15:01:49,834 ERROR] ror.ErrorMvcAutoConfiguration$StaticView: 206 [http-nio-13280-exec-16] - Cannot render error page for request [/lib/personGraph] and exception [Null key for a Map not allowed in JSON (use a converting NullKeySerializer?) (through reference chain: java.util.HashMap["aux"]->java.util.HashMap["null"])] as the response has already been committed. As a result, the response may have the wrong status code.
MarcAgate commented 4 years ago

The short story first: the exception is comming from a null key in the results Map originating from blank nodes in the model returned by the query. As far as website hanging is concerned, I cannot say anything helpful for now.

Here is the corresponding query:


CONSTRUCT 
  { 
    ?res tmp:status ?st .
    ?res tmp:matchScore ?sc .
    ?res tmp:nameMatch ?nameMatch .
    ?res tmp:noteMatch ?noteMatch .
    ?res tmp:isMain true .
    ?res tmp:isCreator ?isCreator .
    ?res ?resp ?reso .
    ?res tmp:yearStart ?yearStart .
    ?res tmp:provider ?provider .
    ?res tmp:originalRecord ?originalRecord .
    ?evt ?evtp ?evto .
    ?name ?namep ?nameo .
  }
WHERE
  {   {   { ( ?name ?sc ?nameMatch )
                   text:query   ( rdfs:label "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   :personName  ?name .
            ?name  ?namep       ?nameo
          }
        UNION
          { ( ?res ?sc ?nameMatch )
                   text:query  ( :skosLabels "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   rdf:type    :Person
          }
        UNION
          { ( ?note ?sc ?noteMatch )
                   text:query  ( :noteText "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   :note       ?note ;
                   rdf:type    :Person
          }
        VALUES ?resp { skos:altLabel skos:prefLabel skos:placeEvent :personGender :personName :personEvent owl:sameAs rdfs:seeAlso tmp:entityScore }
        ?res     ?resp           ?reso .
        ?resAdm  adm:adminAbout  ?res ;
                 adm:status      ?st .
        ?resAdm adm:metadataLegal/adm:provider ?provider
        BIND(EXISTS { ?tmp  :agent  ?res } AS ?isCreator)
      }
    UNION
      {   { ( ?name ?sc ?nameMatch )
                   text:query   ( rdfs:label "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   :personName  ?name .
            ?name  ?namep       ?nameo
          }
        UNION
          { ( ?res ?sc ?nameMatch )
                   text:query  ( :skosLabels "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   rdf:type    :Person
          }
        UNION
          { ( ?note ?sc ?noteMatch )
                   text:query  ( :noteText "\"bdud 'dul rdo rje\""@bo-x-ewts 1000 "highlight:" ) .
            ?res   :note       ?note ;
                   rdf:type    :Person
          }
        ?res  :personEvent  ?evt .
        ?evt  rdf:type      ?evtType
        FILTER ( ?evtType IN (:PersonBirth, :PersonDeath) )
        ?evt  ?evtp  ?evto
        BIND(if(( ( ?evtType = :PersonBirth ) && ( ( ?evtp = :onYear ) || ( ?evtp = :notBefore ) ) ), ?evto, ( 1 / 0 )) AS ?yearStart)
      }
  }

part of the result contains:

bdr:NM19FFE080FD47C116 , bdr:NM10E87BDDB7E5BBC8 ;
        tmp:entityScore   7 ;
        tmp:isCreator     true ;
        tmp:isMain        true ;
        tmp:matchScore    "17.712336"^^xsd:float , "17.133064"^^xsd:float , "15.571538"^^xsd:float , "13.698758"^^xsd:float ;
        tmp:nameMatch     "rig 'dzin ↦bdud 'dul rdo rje↤/"@bo-x-ewts , "↦bdud 'dul rdo rje↤/"@bo-x-ewts , "mag sar paN+Di ta 03 ↦bdud 'dul rdo rje↤/"@bo-x-ewts ;
        tmp:provider      bda:CP021 ;
        tmp:status        bda:StatusReleased ;
        tmp:yearStart     "1840"^^xsd:gYear ;
        owl:sameAs        <http://api.treasuryoflives.org/resource/TOLP10664> ;
        skos:prefLabel    "bdud 'dul rdo rje/"@bo-x-ewts .

[ a           bdo:PersonOtherName ;
  rdfs:label  "skal bzang pad+ma dbang rgyal bdud 'dul rdo rje"@bo-x-ewts , "skal bzang pad+ma dbang rgyal"@bo-x-ewts , "rdo rje brag rig 'dzin 08 skal bzang pad+ma dbang rgyal"@bo-x-ewts , "སྐལ་བཟང་པདྨ་དབང་རྒྱལ།"@bo , "The Eighth Dorje Drak Rigdzin, Kelzang Pema Wanggyel" , "Kelzang Pema Wanggyel Dudul Dorje"
] 

which leads to blank node processing in Type results (these are the one I found):

SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "Kelzang Pema Wanggyel Dudul Dorje"]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "The Eighth Dorje Drak Rigdzin, Kelzang Pema Wanggyel"]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "སྐལ་བཟང་པདྨ་དབང་རྒྱལ།"@bo]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "rdo rje brag rig 'dzin 08 skal bzang pad+ma dbang rgyal"@bo-x-ewts]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "skal bzang pad+ma dbang rgyal"@bo-x-ewts]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/2000/01/rdf-schema#label, "skal bzang pad+ma dbang rgyal bdud 'dul rdo rje"@bo-x-ewts]
SUBJECT URI >>null
SUBJECT URI STATEMENt >>[aed3c5eb577a11c71463d32d1bcbbd24, http://www.w3.org/1999/02/22-rdf-syntax-ns#type, http://purl.bdrc.io/ontology/core/PersonOtherName]
SUBJECT URI >>null

so it leads to a null key in the aux HashMap, here: https://github.com/buda-base/lds-pdi/blob/master/src/main/java/io/bdrc/ldspdi/results/library/TypeResults.java#L53

and the HashMap looks like this (with a null key at the very beginning):

RES >>{aux={null=[{xml:lang=, type=http://www.w3.org/2000/01/rdf-schema#label, value=Kelzang Pema Wanggyel Dudul Dorje}, {xml:lang=, type=http://www.w3.org/2000/01/rdf-schema#label, value=The Eighth Dorje Drak Rigdzin, Kelzang Pema Wanggyel}, {xml:lang=bo, type=http://www.w3.org/2000/01/rdf-schema#label, value=སྐལ་བཟང་པདྨ་དབང་རྒྱལ།}, {xml:lang=bo-x-ewts, type=http://www.w3.org/2000/01/rdf-schema#label, value=rdo rje brag rig 'dzin 08 skal bzang pad+ma dbang rgyal}, {xml:lang=bo-x-ewts, type=http://www.w3.org/2000/01/rdf-schema#label, value=skal bzang pad+ma dbang rgyal}, {xml:lang=bo-x-ewts, type=http://www.w3.org/2000/01/rdf-schema#label, value=skal bzang pad+ma dbang rgyal bdud 'dul rdo rje}, {type=http://www.w3.org/1999/02/22-rdf-syntax-ns#type, value=http://purl.bdrc.io/ontology/core/PersonOtherName}, {type=http://www.w3.org/1999/02/22-rdf-syntax-ns#type, value=http://purl.bdrc.io/ontology/core/PersonDeath}, {xml:lang=, type=http://purl.bdrc.io/ontology/core/onYear, value=1880}, {type=http://www.w3.org/1999/02/22-rdf-syntax-ns#type, value=http://purl.bdrc.io/ontology/core/PersonBirth}, {xml:lang=, type=http://purl.bdrc.io/ontology/core/onYear, value=1848}, {type=http://www.w3.org/1999/02/22-rdf-syntax-ns#type, value=http://purl.bdrc.io/ontology/core/PersonDeath}, {xml:lang=, type=http://purl.bdrc.io/ontology/core/onYear, value=1797}, {xml:lang=bo-x-ewts, type=http://www.w3.org/2000/01/rdf-schema#label, value=bdud 'dul rdo rje}, {xml:lang=, type=http://www.w3.org/2000/01/rdf-schema#label, value=The Thirteenth Karmapa, Dudul Dorje},ETC...

eroux commented 4 years ago

thanks! fixed it