You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/10/10 11:15:32 UTC

[GitHub] [apisix] jiasanshou opened a new issue, #8065: bug: batch_process:push method failed ,if not using promethus

jiasanshou opened a new issue, #8065:
URL: https://github.com/apache/apisix/issues/8065

   ### Current Behavior
   
   Method "batch_process:push" in batch-processor.lua report error: attempt to index a nil value.
   ` if prometheus and not batch_metrics and self.name
          and self.route_id and self.server_addr then
           batch_metrics = prometheus.get_prometheus():gauge("batch_process_entries",
                                                             "batch process remaining entries",
                                                             {"name", "route_id", "server_addr"})
       end`
   the code determine prometheus but not  prometheus.get_prometheus() .
   
   ### Expected Behavior
   
   In the version 2.12, the code is different and it works.
   `if not batch_metrics and prometheus.get_prometheus() and self.name
          and self.route_id and self.server_addr then
           batch_metrics = prometheus.get_prometheus():gauge("batch_process_entries",
                                                             "batch process remaining entries",
                                                             {"name", "route_id", "server_addr"})
       end`
   The code use if not batch_metrics and **prometheus.get_prometheus()** , so it works well.
   
   ### Error Logs
   
   2022/10/10 19:07:52 [error] 15074#0: *1109498 failed to run log_by_lua*: .../software/apisix-2.15.0/apisix/utils/batch-processor.lua:189: attempt to index a nil value
   stack traceback:
           .../software/apisix-2.15.0/apisix/utils/batch-processor.lua:189: in function 'push'
           ...e/apisix-2.15.0/apisix/utils/batch-processor-manager.lua:121: in function 'add_entry_to_new_processor'
   
   ### Steps to Reproduce
   
   1.Run apisix in docker without promethus.
   2.config a route with kafka-logger
   3.fire a request, get the error.
   
   ### Environment
   
   - APISIX version 2.15 (run `apisix version`):
   - Operating system linux (run `uname -a`):
   
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1276947709

   @jiasanshou Could you show more details about how to reproduce the problem? the `prometheus.get_prometheus()` seems that it won't be `nil` anyway


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] tzssangglass commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1277793217

   > if we do not use the plugin prometheus, whether the method "http_init" will be executed?
   
   `core.table.array_find(http_plugin_names, "prometheus")` will determine if you have the prometheus plugin enabled. If it is not enabled, it will not executed `http_init `.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] jiasanshou commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
jiasanshou commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1277089277

   > @jiasanshou Could you show more details about how to reproduce the problem? the `prometheus.get_prometheus()` seems that it won't be `nil` anyway
   
   I have no idea.
   I just upgrade the apisix from 2.12 to 2.15, and after that ,the kafka-logger report this error. I checked the configs, and it seams that there is nothing special.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] jiasanshou commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
jiasanshou commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1277130276

   > > @jiasanshou Could you show more details about how to reproduce the problem? the `prometheus.get_prometheus()` seems that it won't be `nil` anyway
   > 
   > I have no idea. I just upgrade the apisix from 2.12 to 2.15, and after that ,the kafka-logger report this error. I checked the configs, and it seams that there is nothing special.
   
   I find that in the plugin.lua。there is
   `  -- some plugins need to be initialized in init* phases
       if is_http and core.table.array_find(http_plugin_names, "prometheus") then
           local prometheus_enabled_in_stream =
               core.table.array_find(stream_plugin_names, "prometheus")
           require("apisix.plugins.prometheus.exporter").http_init(prometheus_enabled_in_stream)
       elseif not is_http and core.table.array_find(stream_plugin_names, "prometheus") then
           require("apisix.plugins.prometheus.exporter").stream_init()
       end`  in line 671. so , if we do not use the plugin prometheus, whether the method "http_init" will be executed? 
   [init prometheus](https://github.com/apache/apisix/blob/2.15.0/apisix/plugin.lua)


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1275733420

   I can't reproduce the problem, because the prometheus will always initialize properly.
   But what you point is right, i will fix this.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1274056007

   I will check this later


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] jiasanshou commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
jiasanshou commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1278408389

   > 
   
   ok,if http_init  is not executed(which will initialize prometheus), then prometheus is not initialized properly, so , these things result in this bug. Am i right?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8065:
URL: https://github.com/apache/apisix/issues/8065#issuecomment-1278579019

   I have reproduced the problem with `prometheus` plugin disabled 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] spacewander closed issue #8065: bug: batch_process:push method failed in 2.15.0

Posted by GitBox <gi...@apache.org>.
spacewander closed issue #8065: bug: batch_process:push method failed in 2.15.0
URL: https://github.com/apache/apisix/issues/8065


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org