lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Risden (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SOLR-6676) Return 500 if bad json data is posted to Solr?
Date Thu, 29 Sep 2016 21:42:20 GMT

    [ https://issues.apache.org/jira/browse/SOLR-6676?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15534139#comment-15534139
] 

Kevin Risden commented on SOLR-6676:
------------------------------------

Looks like this has seen been fixed with a better error message and returns a 400 error code:

{code}
# ./bin/solr create -c test

Copying configuration to new core instance directory:
/opt/solr/server/solr/test

Creating new core 'test' using command:
http://localhost:8983/solr/admin/cores?action=CREATE&name=test&instanceDir=test

{
  "responseHeader":{
    "status":0,
    "QTime":1863},
  "core":"test"}
# ./bin/post -c test example/exampledocs/books.json
/usr/lib/jvm/java-1.8-openjdk/jre/bin/java -classpath /opt/solr/dist/solr-core-6.2.1.jar -Dauto=yes
-Dc=test -Ddata=files org.apache.solr.util.SimplePostTool example/exampledocs/books.json
SimplePostTool version 5.0.0
Posting files to [base] url http://localhost:8983/solr/test/update...
Entering auto mode. File endings considered are xml,json,jsonl,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
POSTing file books.json (application/json) to [base]/json/docs
SimplePostTool: WARNING: Solr returned an error #400 (Bad Request) for url: http://localhost:8983/solr/test/update/json/docs
SimplePostTool: WARNING: Response: {"responseHeader":{"status":400,"QTime":36},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.common.SolrException"],"msg":"Cannot
parse provided JSON: Expected ',' or '}': char=i,position=243 BEFORE='ns\", \"sequence_i\"
: 1, \"genre_s\" : \"fantasy\\\", \"i' AFTER='nStock\" : true, \"price\" : 12.50, '","code":400}}
SimplePostTool: WARNING: IOException while reading response: java.io.IOException: Server returned
HTTP response code: 400 for URL: http://localhost:8983/solr/test/update/json/docs
1 files indexed.
COMMITting Solr index changes to http://localhost:8983/solr/test/update...
Time spent: 0:00:00.097
{code}

> Return 500 if bad json data is posted to Solr?
> ----------------------------------------------
>
>                 Key: SOLR-6676
>                 URL: https://issues.apache.org/jira/browse/SOLR-6676
>             Project: Solr
>          Issue Type: Bug
>          Components: update
>    Affects Versions: 4.7.2
>            Reporter: liuqibj
>
> When posting  invalid json data to Solr and we often get 400 response code but some cases
return 500 if bad json data is posted. The call stack looks like this(see below). There are
multiple reasons if Solr return 500 errors.  Is there any way to distinguish whether the 500
errors is due to bad json data or other reasons?
> at org.apache.noggit.JSONParser.err
> at org.apache.noggit.JSONParser.next
> at org.apache.noggit.JSONParser.nextEvent
> at org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.processUpdate
> at org.apache.solr.handler.loader.JsonLoader$SingleThreadedJsonLoader.load
> at org.apache.solr.handler.loader.JsonLoader.load



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message