SolrNet 在查询字符串中小写 Solr 字段名称,导致 Solr 1.4 失败

发布于 2024-11-30 05:15:14 字数 2060 浏览 4 评论 0 原文

这是我们大约一年前开始看到的一个奇怪的错误。起初,我只是偶尔在我的开发机器上注意到它,但现在它开始出现在生产中,这是有问题的。

我们在生产中使用 Ubuntu (11.04) 和 Mono 2.6.7(我也可以使用 Mono 2.10.x 进行重现),在 apache 内使用 mod_mono。

基本上,有时(很难重现),当 apache 启动应用程序时,SolrNet 决定将其传输到 solr 服务器的整个 URL 小写。如果应用程序处于这种状态,它将保持这种状态,直到重新启动(有时需要重新启动几次才能清除)。我们可能会重新启动 20 - 50 次或更多次,而不会出现此问题。或者有时每隔 2 或 3 次就会发生一次。

一个好的 url 看起来像这样:

INFO: [] webapp=/solr path=/select params={sort=Creative.PromotionalScore+desc&start=0&q=*:*&?=&qt=standard&fq={!tag%3DCreative.GalleryReviewStatus}Creative.GalleryReviewStatus:Approved&fq={!tag%3DCreative.SectionIncludedTarget}Creative.SectionIncludedTarget:220358+OR+(NOT+Creative.SectionIncludedTarget:[*+TO+*]+*:*)&fq={!tag%3DActive}Active:true&fq={!tag%3DCreative.ShowInGallery}Creative.ShowInGallery:true&fq={!tag%3DCreative.Size}Creative.Size:"Rectangle"&fq={!tag%3DRecordType}RecordType:FiveToOne.Gallery.Rmx.Creative&rows=12} 

一个坏的 url 看起来像这样:(

http://solrServer:8080/solr/select?qt=standard&fq=%7b!tag%3dcreative.galleryreviewstatus%7dcreative.galleryreviewstatus%3aapproved&fq=%7b!tag%3dcreative.sectionincludedtarget%7dcreative.sectionincludedtarget%3a306433+or+(not+creative.sectionincludedtarget%3a%5b*+to+*%5d+*%3a*)&fq=%7b!tag%3dactive%7dactive%3atrue&fq=%7b!tag%3dcreative.showingallery%7dcreative.showingallery%3atrue&fq=%7b!tag%3dcreative.size%7dcreative.size%3a%22rectangle%22&fq=%7b!tag%3drecordtype%7drecordtype%3afivetoone.gallery.rmx.creative&sort=creative.promotionalscore+desc&rows=18&start=0&q=*%3a*&?

首先,我很抱歉,这两个 URL 是从管道的不同阶段提取的,目前我可以访问的所有 URL .)

当提交错误的 url 时,Solr 会抛出致命异常,抱怨未知字段:

HTTP Status 400 - can not sort on undefined field: creative.promotionalscore

type Status report

message can not sort on undefined field: creative.promotionalscore

description The request sent by the client was syntactically incorrect (can not sort on undefined field: creative.promotionalscore).

This is a strange bug that we started seeing about a year ago. At first, I only occasionally noticed it on my dev machine, but now it's been starting to appear in production, which is problematic.

We use Ubuntu (11.04), and Mono 2.6.7 in production (I can also repro with Mono 2.10.x), inside apache, using mod_mono.

Basically, sometimes (very hard to reproduce), when apache starts the application, SolrNet decides to lower case the entire URL it transmits to the solr server. If the application is in this state, it stays this way until it is restarted (and occasionally requires a couple of restarts to clear up.) We might go for 20 - 50 or more restarts without seeing this problem come up. or sometimes it will happen every 2 or 3.

A good url looks like this:

INFO: [] webapp=/solr path=/select params={sort=Creative.PromotionalScore+desc&start=0&q=*:*&?=&qt=standard&fq={!tag%3DCreative.GalleryReviewStatus}Creative.GalleryReviewStatus:Approved&fq={!tag%3DCreative.SectionIncludedTarget}Creative.SectionIncludedTarget:220358+OR+(NOT+Creative.SectionIncludedTarget:[*+TO+*]+*:*)&fq={!tag%3DActive}Active:true&fq={!tag%3DCreative.ShowInGallery}Creative.ShowInGallery:true&fq={!tag%3DCreative.Size}Creative.Size:"Rectangle"&fq={!tag%3DRecordType}RecordType:FiveToOne.Gallery.Rmx.Creative&rows=12} 

A bad url looks like this:

http://solrServer:8080/solr/select?qt=standard&fq=%7b!tag%3dcreative.galleryreviewstatus%7dcreative.galleryreviewstatus%3aapproved&fq=%7b!tag%3dcreative.sectionincludedtarget%7dcreative.sectionincludedtarget%3a306433+or+(not+creative.sectionincludedtarget%3a%5b*+to+*%5d+*%3a*)&fq=%7b!tag%3dactive%7dactive%3atrue&fq=%7b!tag%3dcreative.showingallery%7dcreative.showingallery%3atrue&fq=%7b!tag%3dcreative.size%7dcreative.size%3a%22rectangle%22&fq=%7b!tag%3drecordtype%7drecordtype%3afivetoone.gallery.rmx.creative&sort=creative.promotionalscore+desc&rows=18&start=0&q=*%3a*&?

(first, I apologize, these two URLs are extracted from different stages of the pipe, all I have access to at the moment.)

When the bad url is submitted, Solr throws a fatal exception, complaining of an unknown field:

HTTP Status 400 - can not sort on undefined field: creative.promotionalscore

type Status report

message can not sort on undefined field: creative.promotionalscore

description The request sent by the client was syntactically incorrect (can not sort on undefined field: creative.promotionalscore).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

潇烟暮雨 2024-12-07 05:15:14

在生产中使用 Solr 和 SolrNet 已有四年了,我只能说我从未在 .NET 上见过这个,所以我猜测这是 Mono 中的一个错误。

为了查明 URL 在哪里变成小写,我放置了几个日志点,例如 此处此处,以及此处

日志记录到位后,一旦出现错误,就应该分析日志,可能应该细化日志记录等,直到找到错误的确切来源。

希望该错误能够被重现、报告、修复等。

Having used Solr and SolrNet in production for four years now, all I can say is that I've never seen this on .NET, so I'm guessing it's a bug in Mono.

In order to pinpoint where exactly the URL is becoming lowercase, I'd put several logging points, for example here, here, and here.

After this logging is in place, once the bug occurs, the log should be analyzed, logging should be probably refined, etc, until the exact source of the bug is located.

Hopefully then the bug can be reproduced, reported, fixed, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文