You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2020/05/19 06:42:49 UTC
[GitHub] [lucene-solr] mkhludnev commented on a change in pull request #1527: SOLR-14384 Stack SolrRequestInfo
mkhludnev commented on a change in pull request #1527:
URL: https://github.com/apache/lucene-solr/pull/1527#discussion_r427064514
##########
File path: solr/core/src/java/org/apache/solr/request/SolrRequestInfo.java
##########
@@ -52,35 +54,44 @@
private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
public static SolrRequestInfo getRequestInfo() {
- return threadLocal.get();
+ if (threadLocal.get().isEmpty()) return null;
+ return threadLocal.get().peek();
}
public static void setRequestInfo(SolrRequestInfo info) {
- // TODO: temporary sanity check... this can be changed to just an assert in the future
- SolrRequestInfo prev = threadLocal.get();
- if (prev != null) {
- log.error("Previous SolrRequestInfo was not closed! req={}", prev.req.getOriginalParams());
- log.error("prev == info : {}", prev.req == info.req, new RuntimeException());
+ if (info == null) {
+ throw new IllegalArgumentException("SolrRequestInfo is null");
+ } else {
+ threadLocal.get().push(info);
Review comment:
Shouldn't we limit maximum stack depth?
What if one component leak SolrRequestInfo accidentally, like push it on every request but refuse to pop it when exception occur. Thus it may steadily flood heap. Or I miss something?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org