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

[BUG] In the case of new deployment, when obtaining an administrator token and obtaining a user token, an auth error will appear and the service will crash. #2880

Open
hejianbing opened this issue Nov 23, 2024 · 5 comments
Assignees
Labels
bug Categorizes issue or PR as related to a bug.

Comments

@hejianbing
Copy link

hejianbing commented Nov 23, 2024

OpenIM Server Version

v3.8.2

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

ubuntu@ip-172-31-18-24:~/next-im$ panic: runtime error: slice bounds out of range [:2] with capacity 1

goroutine 75 [running]:
github.com/xxxxxxxxxx/next-im/pkg/common/storage/controller.(*authDatabase).checkToken(0xc000115810, {0x1696008?, 0xc00060acc0?}, 0xc000a0d860, 0x7)
/home/ubuntu/next-im/pkg/common/storage/controller/auth.go:161 +0x1158
github.com/xxxxxxxxxx/next-im/pkg/common/storage/controller.(*authDatabase).CreateToken(0xc000115810, {0x1696008, 0xc00060acc0}, {0xc000133230, 0x11}, 0x7)
/home/ubuntu/next-im/pkg/common/storage/controller/auth.go:90 +0xf1
github.com/xxxxxxxxxx/next-im/internal/rpc/auth.(*authServer).GetUserToken(0xc0003a18f0, {0x1696008, 0xc00060acc0}, 0xc0004c2800)
/home/ubuntu/next-im/internal/rpc/auth/auth.go:120 +0x12a
github.com/xxxxxxxxxx/next-protocol/auth._Auth_GetUserToken_Handler.func1({0x1696008?, 0xc00060acc0?}, {0x13b7580?, 0xc0004c2800?})
/root/go/pkg/mod/github.com/xxxxxxxxxx/[email protected]/auth/auth.pb.go:1118 +0xcb
github.com/xxxxxxxxxx/next-im/pkg/common/startrpc.Start[...].prommetricsUnaryInterceptor.func6({0x13b7580?, 0xc0004c2800?}, 0xc000a4f840?, 0x0?)
/home/ubuntu/next-im/pkg/common/startrpc/start.go:185 +0x58
google.golang.org/grpc.getChainUnaryHandler.func1({0x1696008, 0xc00060acc0}, {0x13b7580, 0xc0004c2800})
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1211 +0xb2
github.com/xxxxxxxxxx/next-tools/mw.RpcServerInterceptor({0x1696008, 0xc00060aa50}, {0x13b7580, 0xc0004c2800}, 0xc000a4f840?, 0xc0004c2840)
/root/go/pkg/mod/github.com/xxxxxxxxxx/[email protected]/mw/rpc_server_interceptor.go:50 +0x233
google.golang.org/grpc.NewServer.chainUnaryServerInterceptors.chainUnaryInterceptors.func1({0x1696008, 0xc00060aa50}, {0x13b7580, 0xc0004c2800}, 0xc000a4f840, 0x78?)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1202 +0x85
github.com/xxxxxxxxxx/next-protocol/auth._Auth_GetUserToken_Handler({0x13b7040, 0xc0003a18f0}, {0x1696008, 0xc00060aa50}, 0xc000434680, 0xc0000911a0)
/root/go/pkg/mod/github.com/xxxxxxxxxx/[email protected]/auth/auth.pb.go:1120 +0x143
google.golang.org/grpc.(*Server).processUnaryRPC(0xc000031600, {0x1696008, 0xc00060a9c0}, {0x169dc80, 0xc0001309c0}, 0xc0003a6a20, 0xc0003a1980, 0x2168938, 0x0)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1394 +0xe2b
google.golang.org/grpc.(*Server).handleStream(0xc000031600, {0x169dc80, 0xc0001309c0}, 0xc0003a6a20)
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1805 +0xe8b
google.golang.org/grpc.(*Server).serveStreams.func2.1()
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1029 +0x7f
created by google.golang.org/grpc.(*Server).serveStreams.func2 in goroutine 72
/root/go/pkg/mod/google.golang.org/[email protected]/server.go:1040 +0x125

Screenshots Link

No response

@hejianbing hejianbing added the bug Categorizes issue or PR as related to a bug. label Nov 23, 2024
@OpenIM-Robot
Copy link

Hello! Thank you for filing an issue.

If this is a bug report, please include relevant logs to help us debug the problem.

Join slack 🤖 to connect and communicate with our developers.

@OpenIM-Robot OpenIM-Robot changed the title [BUG] 新部署的情况下,获取一次管理员token,在获取一次用户token,会出现auth 报错 服务崩溃 [BUG] In the case of new deployment, when obtaining an administrator token and obtaining a user token, an auth error will appear and the service will crash. Nov 23, 2024
@hejianbing
Copy link
Author

curl --location --request POST 'http://${domain}/auth/get_admin_token'
--header 'operationID: 1732326432959'
--header 'Content-Type: application/json'
--data-raw '{
"secret": "openIM123",
"userID": "imAdmin"
}'

curl --location --request POST 'http://${domain}/auth/get_user_token'
--header 'operationID: 1732326486026'
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJpbUFkbWluIiwiUGxhdGZvcm1JRCI6MTAsImV4cCI6MTc0MDEwMjEzMiwibmJmIjoxNzMyMzI1ODMyLCJpYXQiOjE3MzIzMjYxMzJ9.jQTWHmfuDq20bnsCjAXEup0m7q8GywIoJyqU7koCZMY'
--header 'Content-Type: application/json'
--data-raw '{
"platformID": 7,
"userID": "21256386688057344"
}'

@OpenIM-Robot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


curl --location --request POST 'http://${domain}/auth/get_admin_token'
--header 'operationID: 1732326432959'
--header 'Content-Type: application/json'
--data-raw '{
"secret": "openIM123",
"userID": "imAdmin"
}'

curl --location --request POST 'http://${domain}/auth/get_user_token'
--header 'operationID: 1732326486026'
--header 'token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJpbUFkbWluIiwiUGxhdGZvcm1JRCI6MTAsImV4cCI6MTc0MDEwMjEzMiwibmJmIjoxNzMyMzI1ODMyLCJpYXQiOjE3MzIzMjYxMzJ9.jQTWHmfuDq20bnsCjAXEup0m7q8GywIoJyqU7koCZMY'
--header 'Content-Type: application/json'
--data-raw '{
"platformID": 7,
"userID": "21256386688057344"
}'

@hejianbing
Copy link
Author

image

@OpenIM-Robot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

3 participants