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

[Lua]SkyWalking-nginx-lua0.3.0 traceid repeat all the time #5805

Closed
3 tasks
gudandezhu opened this issue Nov 6, 2020 · 10 comments · Fixed by apache/skywalking-nginx-lua#52
Closed
3 tasks
Assignees
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug! Nginx Nginx LUA agent

Comments

@gudandezhu
Copy link

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • Question or discussion
  • Bug
  • Requirement
  • Feature or performance improvement

Bug

skywalking-nginx-lua0.3.0 , macOS , JRE8.0

when I used skywalking-nginx-lua0.3.0 , I got the same traceid(all api) ,I just changed the Nginx.conf
next is my nginx.conf :
image

this is log:
image

@wu-sheng wu-sheng added agent Language agent related. bug Something isn't working and you are sure it's a bug! Nginx Nginx LUA agent labels Nov 6, 2020
@gudandezhu gudandezhu changed the title [Lua]SkyWalking-nginx-lua0.3.0 traced repeat all the time [Lua]SkyWalking-nginx-lua0.3.0 traceid repeat all the time Nov 6, 2020
@wu-sheng
Copy link
Member

wu-sheng commented Nov 6, 2020

@moonming @dmsolr We need to recheck this, once this is true, we need a 0.3.1 directly.

@wu-sheng wu-sheng added the high priority High priority issue, blocking next release. label Nov 6, 2020
@wu-sheng wu-sheng added this to the NIGNX-LUA 0.4.0 milestone Nov 6, 2020
@Miss-you
Copy link
Member

Miss-you commented Nov 6, 2020

/accept

@wu-sheng
Copy link
Member

wu-sheng commented Nov 6, 2020

Seem @membphis 's local test doesn't show the same issue.

image

@membphis
Copy link
Member

membphis commented Nov 6, 2020

we need to set the random seed in init_worker_by_lua_block phase:

--- a/README.md
+++ b/README.md
@@ -32,6 +32,7 @@ http {
         -- Instance means the number of Nginx deployment, does not mean the worker instances
         metadata_buffer:set('serviceInstanceName', 'User Service Instance Name')

+        require("skywalking.util").set_randomseed()
         require("skywalking.client"):startBackendTimer("http://127.0.0.1:8080")
     }

image

I will submit a new PR about this.

@Miss-you
Copy link
Member

Miss-you commented Nov 6, 2020

I think it's better to use ngx.var.request_id rather than generate uuid by itself.

@wu-sheng
Copy link
Member

wu-sheng commented Nov 6, 2020

I like @Miss-you 's idea.

@Miss-you
Copy link
Member

Miss-you commented Nov 6, 2020

The distributed unique id generation algorithm is a classic problem, so we'll just use ngx.var.request_id here.

@wu-sheng wu-sheng removed the high priority High priority issue, blocking next release. label Nov 6, 2020
@wu-sheng
Copy link
Member

wu-sheng commented Nov 6, 2020

I have removed high-priority as this UUID should be safe(maybe?). @Miss-you feel free to submit a PR to implement in your way, and we could include it in the 0.4.0.

@membphis
Copy link
Member

membphis commented Nov 6, 2020

@gudandezhu please confirm if you enabled the directive lua_code_cache in your Nginx config.

I can get the same output when using lua_code_cache off in Nginx config.

  1. please remove lua_code_cache or set lua_code_cache on.
  2. add require("skywalking.util").set_randomseed() in init_worker_by_lua_block, here is example: https://github.com/apache/skywalking-nginx-lua/pull/52/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5R36

wu-sheng pushed a commit to apache/skywalking-nginx-lua that referenced this issue Nov 6, 2020
* doc: set random seed in `init_worker` phase.

try to fix issue: apache/skywalking#5805 .

* e2e: set random seed.
@gudandezhu
Copy link
Author

yes , remove lua_code_cache is right

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent Language agent related. bug Something isn't working and you are sure it's a bug! Nginx Nginx LUA agent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants