Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when I use producer:new(kafka_list, kafka_conf) #148

Open
chenzhaoyangATgithub opened this issue Feb 21, 2023 · 1 comment
Open

when I use producer:new(kafka_list, kafka_conf) #148

chenzhaoyangATgithub opened this issue Feb 21, 2023 · 1 comment

Comments

@chenzhaoyangATgithub
Copy link

When I use this module in Kong, I meet the following problems.
Kong docker images is kong:latest,and I install this module by "luarocks install lua-resty-kafka"

If I set kafka_conf.producer_type = "async", then I can't restart my kong. And the error is "/usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started"

init_by_lua error: /usr/local/share/lua/5.1/kong/tools/utils.lua:699: error loading module 'kong.plugins.ok-api-log.handler':
/usr/local/share/lua/5.1/resty/timerng/init.lua:407: the timer module is not started
stack traceback:
[C]: in function 'assert'
/usr/local/share/lua/5.1/resty/timerng/init.lua:407: in function 'timer_every'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:350: in function 'new'
./kong/plugins/ok-api-log/handler.lua:6: in main chunk
[C]: at 0xffffbd1220c8
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/kong/tools/utils.lua:690: in function 'load_module_if_exists'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:154: in function 'load_plugin_handler'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:260: in function 'load_plugin'
/usr/local/share/lua/5.1/kong/db/dao/plugins.lua:312: in function 'load_plugin_schemas'
/usr/local/share/lua/5.1/kong/init.lua:593: in function 'init'
init_by_lua:3: in main chunk


If I set kafka_conf.producer_type = "sync", then I can restart my kong. But I can't send msg to kafka and the error is "API disabled in the context of log_by_lua"*
stack traceback:
[C]: in function 'old_tcp'
/usr/local/share/lua/5.1/kong/globalpatches.lua:432: in function 'tcp'
/usr/local/share/lua/5.1/resty/kafka/broker.lua:123: in function 'send_receive'
/usr/local/share/lua/5.1/resty/kafka/client.lua:182: in function '_fetch_metadata'
/usr/local/share/lua/5.1/resty/kafka/client.lua:265: in function 'fetch_metadata'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:123: in function 'choose_partition'
/usr/local/share/lua/5.1/resty/kafka/producer.lua:378: in function 'send'
./kong/plugins/ok-api-log/handler.lua:105: in function <./kong/plugins/ok-api-log/handler.lua:79>
/usr/local/share/lua/5.1/kong/init.lua:374: in function 'execute_collected_plugins_iterator'
/usr/local/share/lua/5.1/kong/init.lua:1500: in function 'log'
log_by_lua(nginx-kong.conf:110):2: in main chunk while logging request,

@doujiang24
Copy link
Owner

Seems kong break the compatibility with the official openresty, better ask kong for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants