0

I am getting "400 Status Bad Request" error when saving product in backend. Product values gets saved, but page remains in the edit screen and displays this error.

This same error also comes when editing Category pages.

Any idea what the issue can be or how to properly debug?

enter image description here

UPDATE: This gets resolved if I change catalog search to "Mysql Fulltext" from SOLR. But what if I want to use Solr, how to prevent this error?

UPDATE: Error while running reindex on Catalog Search Index

Catalog Search Index index process unknown error:
exception 'Exception' with message '"400" Status: Bad Request' in /var/www/dev/store/app/code/core/Enterprise/Search/Model/Client/Solr.php:256
Stack trace:
#0 /var/www/dev/store/lib/Apache/Solr/Service.php(919): Enterprise_Search_Model_Client_Solr->_sendRawPost('http://localhos...', '<optimize waitF...', 3600)
#1 /var/www/dev/store/app/code/core/Enterprise/Search/Model/Adapter/Abstract.php(486): Apache_Solr_Service->optimize()
#2 /var/www/dev/store/app/code/core/Enterprise/Search/Model/Adapter/Abstract.php(388): Enterprise_Search_Model_Adapter_Abstract->optimize()
#3 /var/www/dev/store/app/code/core/Enterprise/Search/Model/Resource/Engine.php(206): Enterprise_Search_Model_Adapter_Abstract->deleteDocs(Array, Array)
#4 /var/www/dev/store/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(302): Enterprise_Search_Model_Resource_Engine->cleanIndex('1', NULL)
#5 /var/www/dev/store/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(133): Mage_CatalogSearch_Model_Mysql4_Fulltext->cleanIndex('1', NULL)
#6 /var/www/dev/store/app/code/core/Mage/CatalogSearch/Model/Mysql4/Fulltext.php(116): Mage_CatalogSearch_Model_Mysql4_Fulltext->_rebuildStoreIndex('1', NULL)
#7 /var/www/dev/store/app/code/core/Mage/CatalogSearch/Model/Fulltext.php(61): Mage_CatalogSearch_Model_Mysql4_Fulltext->rebuildIndex(NULL, NULL)
#8 /var/www/dev/store/app/code/core/Mage/CatalogSearch/Model/Indexer/Fulltext.php(395): Mage_CatalogSearch_Model_Fulltext->rebuildIndex()
#9 /var/www/dev/store/app/code/core/Mage/Index/Model/Process.php(139): Mage_CatalogSearch_Model_Indexer_Fulltext->reindexAll()
#10 /var/www/dev/store/app/code/core/Mage/Index/Model/Process.php(167): Mage_Index_Model_Process->reindexAll()
#11 /var/www/dev/store/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#12 /var/www/dev/store/shell/indexer.php(198): Mage_Shell_Compiler->run()
#13 {main}

This is the URL for which Solr is throwing bad request.

wget http://localhost:8080/solr/update?wt=jsonstore_id:13600
--2013-11-04 15:09:37--  http://localhost:8080/solr/update?wt=jsonstore_id:13600
Resolving localhost... 127.0.0.1
Connecting to localhost|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 400 Bad Request
2013-11-04 15:09:37 ERROR 400: Bad Request.

Checked the error log catalina.out and found out this:

Nov 4, 2013 2:50:33 PM org.apache.solr.update.processor.LogUpdateProcessor finish
INFO: [collection1] webapp=/solr path=/update params={wt=jsonstore_id:13600} {} 0 1
Nov 4, 2013 2:50:33 PM org.apache.solr.common.SolrException log
SEVERE: org.apache.solr.common.SolrException: missing content stream
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:69)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:135)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:1817)
    at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:639)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:345)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:141)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    at java.lang.Thread.run(Thread.java:679)

UPDATE: I don't see PHP is compiled with curl wrappers. So the issue can be different. The URL that is causing this "missing content stream" is:

http://localhost:8080/solr/update?wt=jsonstore_id:13600
10
  • That error is thrown because the indexer is triggered, which tries to index data in Solr. Does your connection to solr work properly? Check the button in the admin backend?
    – Tobias
    Nov 2, 2013 at 12:54
  • In admin the test connection is successful.
    – Kalpesh
    Nov 3, 2013 at 9:45
  • Thanks for the error message, it looks like that problem was already solved over here: stackoverflow.com/questions/8083474/…
    – Tobias
    Nov 5, 2013 at 8:39
  • Yes I have checked that earlier. But we have dev/staging/prod websites on same server so can't do anything with LAMP installation.
    – Kalpesh
    Nov 5, 2013 at 10:37
  • Could you setup a server on your local machine and check it with that?
    – Tobias
    Nov 5, 2013 at 12:55

1 Answer 1

4
+50

So, as this gets a bit long in the comments and you'll anyway have to debug it on your own i'll write down the main problem of this error message and how you could continue to debug it.

/solr/update?wt=jsonstore_id:13600 looks for an input document to index. So calling this URL directly will always end up in this "missing content stream" error.

As already mentioned in the comments every request to Solr in Magento runs through Apache_Solr_Service::__sendRawPost in the lib directory. This is not Magento specific code, it's an implementation of the official PHP Solr Client published by Apache. You can also find some small docs over here: https://code.google.com/p/solr-php-client/

You mentioned that this position is called 3 times, so you should check when exactly the error code 400 is returned. I would recommend to use XDebug and check the response which is initialized also in that same method.

When the update action is called Magento should submit a list of documents (products on Magento site) which Solr has to index. You can also check the current index status with a tool called luke on your solr server: /solr/admin/luke/ This gives you information about the amount of indexed documents and terms and the latest update time, which helps a lot to debug this stuff and see if indexing was successful.

Besides that, what version of EE do you use? There are anyway some open bugs in 1.12 (I don't know if they fixed it in 1.13) and we provided some patches, which might help you to run in further problems: https://github.com/sitewards/SolrPatches

Sorry that I can't give you a direct solution, but with this information it should be possible to debug that stuff on your system and find the error pretty fast.

2
  • You're welcome :)
    – Tobias
    Nov 13, 2013 at 15:37
  • accepted and gave bounty.. i hv not yet solved it as I didn't got enough time and ur answer is not to the point. will ask u if i need any help ;)
    – Kalpesh
    Nov 13, 2013 at 15:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.