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 2020/03/02 14:45:59 UTC

[GitHub] [incubator-apisix] sshniro opened a new issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

sshniro opened a new issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor
URL: https://github.com/apache/incubator-apisix/issues/1181
 
 
   Hi,
   
   When using the [batch processor](https://github.com/apache/incubator-apisix/blob/e1ac426443293c6140ddb257e482537edd43c36a/lua/apisix/plugins/batch-processor.lua#L110) inside the _M.log phase the system throws the following error.
   
   This happens when I use core.schema.check(schema, config) inside the batch processor. 
   If I use a simple validation (if/else) then the workflow is working without an error.
   
   ```lua
   2020/03/02 15:36:40 [error] 5155#5155: *237 failed to run log_by_lua*: coroutine.wrap:20: API disabled in the context of log_by_lua*
   stack traceback:
   	[C]: in function 'create'
   	coroutine.wrap:20: in function '_get_loader'
   	...one3/incubator-apisix//deps/share/lua/5.1/jsonschema.lua:197: in function 'create_obj_fun'
   	...che/clone3/incubator-apisix/lua/apisix/core/lrucache.lua:66: in function 'cached_validator'
   	...pache/clone3/incubator-apisix/lua/apisix/core/schema.lua:34: in function 'check'
   	.../incubator-apisix/lua/apisix/plugins/batch-processor.lua:110: in function 'new'
   	...lone3/incubator-apisix/lua/apisix/plugins/udp-logger.lua:118: in function 'phase_fun'
   	/home/nirojan/apache/clone3/incubator-apisix/lua/apisix.lua:154: in function 'run_plugin'
   	/home/nirojan/apache/clone3/incubator-apisix/lua/apisix.lua:459: in function 'http_log_phase'
   	log_by_lua(nginx.conf:191):2: in main chunk while logging request, client: 127.0.0.1, server: , request: "GET /?param1=value HTTP/1.1", upstream: "http://127.0.0.1:80/?param1=value", host: "127.0.0.1:9080"
   ```
   
   Is this a limitation? Some guidance would be helpful.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor
URL: https://github.com/apache/incubator-apisix/issues/1181#issuecomment-593711676
 
 
   In jsonschema, the compiled Lua code is generated by using yield, but the yield operation is not supported in log_phase.
   
   I suggest modifying the https://github.com/iresty/jsonschema implementation to avoid using the yield method.
   
   https://github.com/iresty/jsonschema/blob/ddd76d719cb102a0db2c44fe207745a9c3e53452/lib/jsonschema.lua#L141

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] membphis commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

Posted by GitBox <gi...@apache.org>.
membphis commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor
URL: https://github.com/apache/incubator-apisix/issues/1181#issuecomment-598168796
 
 
   @sshniro https://github.com/api7/jsonschema/issues/8
   
   I have created an issue, if you would like to do this job, please leave a message on this issue. I will assign this issue to you.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] sshniro commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

Posted by GitBox <gi...@apache.org>.
sshniro commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor
URL: https://github.com/apache/incubator-apisix/issues/1181#issuecomment-598009181
 
 
   I would like to start working on this issue, as it is blocking #965  and #1070  for batch processing. Will post the question in the associated repo.

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] sshniro commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

Posted by GitBox <gi...@apache.org>.
sshniro commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor
URL: https://github.com/apache/incubator-apisix/issues/1181#issuecomment-593539764
 
 
   @membphis I guess APISIX is not allowing to access the JSON schema validator during log phase. Is this due to any performance gain? or shall I use normal validation instead of using the jsonschema?

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


With regards,
Apache Git Services

[GitHub] [incubator-apisix] sshniro commented on issue #1181: bug: coroutine.wrap:20: API disabled in the context of log_by_lua error in Batch Processor

Posted by GitBox <gi...@apache.org>.
sshniro commented on issue #1181:
URL: https://github.com/apache/incubator-apisix/issues/1181#issuecomment-620502126


   Closing this issue, as it's fixed by [#8](https://github.com/api7/jsonschema/issues/8)


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