Giter Site home page Giter Site logo

oimws's People

Contributors

bloomingg avatar cubxxw avatar dependabot[bot] avatar fgadvancer avatar liumingsongning avatar luhaoling avatar withchao avatar xuexihuang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

oimws's Issues

make start no daemon

in makefile,make start not have daemon
## start: Start the service. .PHONY: start start: @$(BIN_DIR)/$(BINS)/main

sqllite 断线导致程序退出

我们的测试流程是这样的:
1、用google chrome浏览器手机模式正常登录一个聊天用户开始聊天
2、用相同的浏览器开另外一个无痕窗口,登录同一个用户
这时必定会报下图中的错误,从而导致程序退出

微信图片_20240227114402
微信图片_20240227134347

oimws服务 down了

2024-01-24 10:27:56.685 DEBUG   [PID:17846]     [open_im_sdk/userRelated.go:428]        TriggerCmdLogout server recycle resources success...    {"operationID": "socket close"}
2024-01-24 10:27:56.685 DEBUG   [PID:17846]     [open_im_sdk/userRelated.go:435]        TriggerCmdLogout client success...      {"operationID": "socket close", "isTokenValid": false}
2024-01-24 10:27:56.685 INFO    [PID:17846]     [interaction/msg_sync.go:107]   msg syncer done, sdk logout.....        {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.685 INFO    [PID:17846]     [interaction/long_conn_mgr.go:288]      heartbeat done sdk logout.....  {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.685 WARN    [PID:17846]     [interaction/long_conn_mgr.go:283]      heartbeat closed        {"operationID": "1706063239423036851", "heartbeat": "heartbeat done sdk logout....."}
2024-01-24 10:27:56.685 INFO    [PID:17846]     [common/trigger_channel.go:214] conversation done sdk logout.....
2024-01-24 10:27:56.685 INFO    [PID:17846]     [open_im_sdk/userRelated.go:255]        logoutListener done sdk logout.....     {"operationID": "f5aiv4bsho1706063236607"}
2024-01-24 10:27:56.696 ERROR   [PID:17846]     [db/chat_log_model_v3.go:38]    create table seq index failed   {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "sql: database is closed"}
2024-01-24 10:27:56.696 ERROR   [PID:17846]     [db/chat_log_model_v3.go:43]    create table send_time index failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "sql: database is closed"}
2024-01-24 10:27:56.696 ERROR   [PID:17846]     [interaction/msg_sync.go:82]    get group normal seq failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169045053480960", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.697 ERROR   [PID:17846]     [db/chat_log_model_v3.go:38]    create table seq index failed   {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "sql: database is closed"}
2024-01-24 10:27:56.697 ERROR   [PID:17846]     [db/chat_log_model_v3.go:43]    create table send_time index failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "sql: database is closed"}
2024-01-24 10:27:56.697 ERROR   [PID:17846]     [interaction/msg_sync.go:82]    get group normal seq failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169059017809920", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.697 ERROR   [PID:17846]     [db/chat_log_model_v3.go:38]    create table seq index failed   {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "sql: database is closed"}
2024-01-24 10:27:56.699 ERROR   [PID:17846]     [db/chat_log_model_v3.go:43]    create table send_time index failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "sql: database is closed"}
2024-01-24 10:27:56.699 ERROR   [PID:17846]     [interaction/msg_sync.go:82]    get group normal seq failed     {"operationID": "ijpw2wbn81706063276370", "conversationID": "sg_1169744316551168", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetConversationNormalMsgSeq()@332: GetConversationNormalMsgSeq: sql: database is closed"}
2024-01-24 10:27:56.699 ERROR   [PID:17846]     [interaction/msg_sync.go:89]    get notification seq failed     {"operationID": "ijpw2wbn81706063276370", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetNotificationAllSeqs()@43: GetNotificationAllSeqs failed: sql: database is closed"}
2024-01-24 10:27:56.699 ERROR   [PID:17846]     [interaction/msg_sync.go:63]    loadSeq err     {"operationID": "ijpw2wbn81706063276370", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetNotificationAllSeqs()@43: GetNotificationAllSeqs failed: sql: database is closed"}
2024-01-24 10:27:56.699 DEBUG   [PID:17846]     [open_im_sdk/userRelated.go:354]        login success...        {"operationID": "ijpw2wbn81706063276370", "login cost time: ": 0.01426576}
2024-01-24 10:27:56.699 DEBUG   [PID:17846]     [interaction/long_conn_mgr.go:279]      heartbeat start {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166435}
2024-01-24 10:27:56.699 DEBUG   [PID:17846]     [interaction/long_conn_mgr.go:171]      readPump start  {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166401}
2024-01-24 10:27:56.699 DEBUG   [PID:17846]     [interaction/long_conn_mgr.go:499]      conn start      {"operationID": "1706063280061962243"}
2024-01-24 10:27:56.699 DEBUG   [PID:17846]     [interaction/long_conn_mgr.go:231]      writePump start {"operationID": "ijpw2wbn81706063276370", "goroutine ID:": 166434}
2024-01-24 10:27:56.700 INFO    [PID:17846]     [interaction/long_conn_mgr.go:554]      long conn establish success     {"operationID": "1706063280061962243", "localAddr": "127.0.0.1:48510", "connNum": 1}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xb168de]

goroutine 166436 [running]:
github.com/openimsdk/openim-sdk-core/v3/internal/interaction.(*MsgSyncer).DoListener(0x0, {0xfdb580, 0xc0005400c0})
        /root/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/internal/interaction/msg_sync.go:104 +0xbe
created by github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(*LoginMgr).run
        /root/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/open_im_sdk/userRelated.go:377 +0xae
make: *** [start] Error 2

以上是截取了部分日志,日志上面有 ERROR 错误。供参考!
[oimws.log](https://github.com/openim-sigs/oimws/files/14033627/oimws.log)

go code error: fn in args num is not match: 10006 SdkInternalError

2024-03-07 11:31:23.750 �[34mINFO�[0m �[34m[PID:44674]�[0m [core_func/ws_handler.go:289] input req {"operationID": "4p8wmpcyhe1709782283749", "function name": "github.com/openimsdk/openim-sdk-core/v3/internal/conversation_msg.(*Conversation).SendMessageNotOss-fm", "args": ["{\"clientMsgID\":\"e0691b46b6b22301722e262aa5dfbdb1\",\"createTime\":1709782283728,\"sendTime\":1709782283728,\"sessionType\":0,\"sendID\":\"5706937089\",\"msgFrom\":100,\"contentType\":101,\"senderPlatformID\":5,\"senderNickname\":\"饭盒1\",\"seq\":0,\"isRead\":false,\"status\":1,\"textElem\":{\"content\":\"11212\"}}","","3578134225","{\"title\":\"you have a new message\",\"desc\":\"you have a new message\",\"ex\":\"\",\"iOSPushSound\":\"\",\"iOSBadgeCount\":true}"]} [2024-03-07 11:31:23.751] [eror] [responder.go:31] msg="sendOnErrorResp" operationID="4p8wmpcyhe1709782283749" event="SendMessageNotOss" err="go code error: fn in args num is not match: 10006 SdkInternalError"
小程序端有问题 其他还ok~ 求救

[DOC]: err="init database problem solution

After starting the oimws service, the connection to port 10003 still failed. Checking the mage log, the full text is as follows:
EROR [2024-06-12 09:24:19.210] [responder.go:31] msg="sendOnErrorResp" operationID="gmm9kk5be31718155459046" event="Login" err="init database ==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.NewDataBase()@88: initDB failed _output/db: ==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).initDB()@116: open db failed /root/oimws/_output/bin/platforms/linux/arm64/_output/db/OpenIM_v3_252817.db: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub: 10006 SdkInternalError"

This issue is due to the 'CGO_ENABLED=0' setting in go env.

Solution:
Enter the following commands in the terminal:
export CGO_ENABLED=1
apt-get update
apt-get install gcc

Check with:
go env | grep CGO_ENABLED
mage
mage start

I hope this issue can help everyone.

oimws Docker image construction

What would you like to share?

仓库的指导文档跑起来太麻烦了,献丑写了个Docker镜像构建文件,方便运行哈哈哈
最终构建出来的镜像文件只有30多M

# 使用官方的 Golang Alpine 镜像作为基础镜像进行构建
FROM golang:1.21.2-alpine AS builder

MAINTAINER zyq [email protected]
# 设置环境变量
ENV GO111MODULE=on \
    GOPROXY=https://proxy.golang.org,direct \
    #启用cgo 制品依赖sqlite3需要
    CGO_ENABLED=1
# 更换依赖源
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories

# 安装必要的依赖和工具
RUN apk update && apk add --no-cache git gcc musl-dev
# 安装mage编译工具
RUN go install github.com/magefile/mage@latest

# 设置工作目录
WORKDIR /app

# 将本地代码复制到容器中
COPY . .

# 构建项目,生成 mage 文件
RUN mage

FROM alpine:latest

# 设置工作目录
WORKDIR /app

RUN mkdir /app/config
# 复制运行配置文件到工作目录
COPY --from=builder /app/config /app/config
#复制编译后制品,不同环境肯能存在不同的构建路径
COPY --from=builder /app/_output/bin/platforms/linux/amd64/openim-sdk /usr/local/bin
# 暴露端口
EXPOSE 10003
# 运行
CMD ["openim-sdk","-c","/app/config"]

Additional information

No response

oimws message "http的headers Authorization中没有对应token", When logging in to JSSDK, the token is spliced after the URL, resulting in the failure to log in

When oimws obtains a token from the request header "Authorization" when the websocket protocol is upgraded, the token is spliced behind the URL when logging in to the jssdk, resulting in oimws not being able to obtain the token and printing the error message "http的headers Authorization中没有对应token", and the jssdk cannot be logged in normally. Currently, you can obtain the token parameter in the url through the nginx proxy and add an Authorization request header to complete the jssdk login.

The issue of lost messages in the iOS version of the mini-program

The iOS version of the mini-program has a problem. When user A switches the mini-program to the background and receives a message from user B, upon returning to the app, A can only see a notification for the unread message. However, clicking on it doesn't display the actual message, and even after refreshing, the message remains invisible. Only when either A or B initiates another message, the previously lost message becomes visible again.

Interestingly, this issue does not occur in the same scenario on the Android version.

在线状态同步问题

oimws更新了3.5.1-beta.1版本,微信小程序端,正常登录和退出,对方看到的在线状态是正确的,如果是切掉进程或者息屏,对方看到的状态就不对了,仍然是在线。然后对方息屏后再打开手机,这时对方本应该看到是在线状态,却变成了离线了。

获取会话列表时,报错database is closed

2024-01-24 10:14:22.952	ERROR	[PID:26443]	[interaction/msg_sync.go:73]	get conversation id list failed	{"operationID": "prgpqt8hz1706062461295", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetAllConversationIDList()@78: GetAllConversationIDList failed : sql: database is closed"}
2024-01-24 10:14:22.952	ERROR	[PID:26443]	[interaction/msg_sync.go:63]	loadSeq err	{"operationID": "prgpqt8hz1706062461295", "error": "==> github.com/openimsdk/openim-sdk-core/v3/pkg/db.(*DataBase).GetAllConversationIDList()@78: GetAllConversationIDList failed : sql: database is closed"}
2024-01-24 10:14:22.952	DEBUG	[PID:26443]	[open_im_sdk/userRelated.go:354]	login success...	{"operationID": "prgpqt8hz1706062461295", "login cost time: ": 0.000692208}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x18 pc=0x100fb6410]

goroutine 25467 [running]:
github.com/openimsdk/openim-sdk-core/v3/internal/interaction.(*MsgSyncer).DoListener(0x0, {0x1014af980, 0x14000902ed0})
	/Users/zhanghui/go/pkg/mod/github.com/openimsdk/openim-sdk-core/[email protected]/internal/interaction/msg_sync.go:104 +0x70
created by github.com/openimsdk/openim-sdk-core/v3/open_im_sdk.(*LoginMgr).run in goroutine 25306
	/Users/zhanghui/go/pkg/mod/github.com/openimsdk/openim-s

Unable to receive offline messages.

On the mini-program side, when a user is offline, there are two scenarios:

  1. If the other party didn't log out properly but merely switched to the background, causing a disconnection, I send them a message. However, when the other party switches back to the foreground, they cannot receive the offline message I just sent. At this point, there is a record in MongoDB, but there is no record in SQLite.

  2. When a user performs a normal account logout, I send them a message. After the other party successfully logs in, they will receive the offline message.

同一userID使用不同platformID申请到不同的token, 用jssdk登录, 会出现概率无法监听到新消息的情况

What happened?

使用同一个userID+2个不同的platformID, 获得到2个不同的token, 在2个浏览器窗口分别使用这些token登录, 并监听新消息(IMSDK.on(CbEvents.OnRecvNewMessages)), 会概率性出现 其中一个窗口监听不到新消息

What did you expect to happen?

两个窗口都能正常使用

How can we reproduce it (as minimally and precisely as possible)?

  1. 使用同一个userID+2个不同的platformID, 获得到2个不同的token(使用api中/auth/user_token)
  2. openim-server 配置多端登陆为10(multiLoginPolicy: 10)
  3. 在2个浏览器窗口分别使用这些token登录, 并监听新消息(IMSDK.on(CbEvents.OnRecvNewMessages))
  4. 发送消息给第一步的userID
    image

login error, code1005

error *errors.withstack not implement CodeError: init database ==)github.com/openimsdk/openim-sdk-core/v3/pkg/db,NewDataBase()0107: initDB failed ./db;==>core/v3/pkg/db.(*DataBase).initDB()@138: open db failed /Users/zhanghui/Project/openim-10006 SdkInternalError
github.com/openimsdk/openim-sdk-
docker/oimws/db/0penIM v3 5aba2dce8afe4eb8a5eb468d185515dd.db: unable to open database file: no such file or directory:

[BUG] The problem of inaccurate display of the number of unread messages

OpenIM Server Version

3.7.1

Operating System and CPU Architecture

Linux (AMD)

Deployment Method

Source Code Deployment

Bug Description and Steps to Reproduce

版本 commit: ea4d8b6
未读消息的数目显示不正确,并且当成功发起调用请求,设置会话为已读后,消息数目不能清除,依然保持原来的数目。排查代码 openim-sdk-core/[email protected]/internal/conversation_msg/read_drawing.go: 142 发现是先获取未读消息列表,然后再清空消息计数表。但是如果未读消息列表为空的时候,就直接返回了,这时候可能计数表大于0(由于某些原因造成的不一致),除非接收到新的未读消息,否则清空计数表的代码不可到达,永远无法清零。

Screenshots Link

相关代码:
765e67d55aa54e8c5ff6674c24f2ec9

前端调用 markConversationMessageAsRead, 服务端 oimws 产生的日志:
0b132ca5f55b4c28e4fe9421a020a65

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.