[GitHub] [lucene-solr] mkhludnev commented on a change in pull request #1527: SOLR-14384 Stack SolrRequestInfo

2020-05-19 Thread GitBox


mkhludnev commented on a change in pull request #1527:
URL: https://github.com/apache/lucene-solr/pull/1527#discussion_r427625556



##
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:
   100 for sure





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene-solr] mkhludnev commented on a change in pull request #1527: SOLR-14384 Stack SolrRequestInfo

2020-05-18 Thread GitBox


mkhludnev commented on a change in pull request #1527:
URL: https://github.com/apache/lucene-solr/pull/1527#discussion_r427066314



##
File path: solr/core/src/java/org/apache/solr/servlet/SolrDispatchFilter.java
##
@@ -456,6 +457,7 @@ public void doFilter(ServletRequest _request, 
ServletResponse _response, FilterC
 
   GlobalTracer.get().clearContext();
   consumeInputFully(request, response);
+  SolrRequestInfo.reset();

Review comment:
   there we need to check that stack have fully cleared and disposed





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:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org



[GitHub] [lucene-solr] mkhludnev commented on a change in pull request #1527: SOLR-14384 Stack SolrRequestInfo

2020-05-18 Thread GitBox


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:
us...@infra.apache.org



-
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org