github-vet / github-vet/rangeloop-pointer-findings

ricktian1226/BatteryRun: MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_mmo_server/server/client.go; 13 LoC

Open
#7,482 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [ricktian1226/BatteryRun](https://www.github.com/ricktian1226/BatteryRun) at [MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_mmo_server/server/client.go](https://github.com/ricktian1226/BatteryRun/blob/c5176485339a69271b83a23982801a67b443c7c1/MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_mmo_server/server/client.go#L135-L147)

Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first
issue it finds, so please do not limit your consideration to the contents of the below message.

> function call which takes a reference to msg at line 141 may start a goroutine

[Click here to see the code in its original context.](https://github.com/ricktian1226/BatteryRun/blob/c5176485339a69271b83a23982801a67b443c7c1/MazeServer2.0.0/gocode/src/guanghuan.com/xiaoyao/battery_mmo_server/server/client.go#L135-L147)

Click here to show the 13 line(s) of Go which triggered the analyzer.

```go
for msg := range c.inqueue {
c.logDebug("Get inbound msg : " + xymmopb.CMD_CODE_name[(int32)(msg.Cmd)])
switch (xymmopb.CMD_CODE)(msg.Cmd) {
case xymmopb.CMD_CODE_CMD_C_Start:
c.processClientStartMsg()
case xymmopb.CMD_CODE_CMD_C_Action:
c.processActionMsg(&msg)
case xymmopb.CMD_CODE_CMD_C_PING:
c.processPingMsg(&msg)
default:
xylogs.Error("Unkown CMD %d ", msg.Cmd)
}
}

```

Click here to show extra information the analyzer produced.

```
The following paths through the callgraph could lead to a goroutine:
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (getResponse, 0) -> (Do, 1) -> (SetDeadline, 1) -> (GetFlags, 0) -> (closeConnection, 0) -> (reConnectToRoute, 1) -> (connectToRoute, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (parseURL, 1) -> (Split, 2) -> (Add, 2) -> (GetFlags, 0) -> (closeConnection, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2) -> (getWarnings, 0) -> (loginRun, 4) -> (f, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2) -> (Unmarshal, 3) -> (syncServersIteration, 1) -> (logf, 1) -> (add, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (Next, 0) -> (run, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (getResponse, 0) -> (Do, 1) -> (SetDeadline, 1) -> (GetFlags, 0) -> (closeConnection, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (marshalText, 3) -> (writeStruct, 2) -> (writeExtensions, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (startLogger, 0) -> (WriteMsg, 2) -> (SendMail, 5) -> (DoRotate, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2) -> (getWarnings, 0) -> (loginRun, 4) -> (f, 0) -> (sasl_errdetail, 1) -> (syncServersIteration, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2) -> (Unmarshal, 3) -> (syncServersIteration, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Write, 1) -> (insertChunk, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (WriteString, 1) -> (Body, 1) -> (NopCloser, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Get, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (getResponse, 0) -> (Do, 1) -> (SetDeadline, 1) -> (GetFlags, 0) -> (closeConnection, 0) -> (reConnectToRoute, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2) -> (Unmarshal, 3) -> (syncServersIteration, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (Next, 0) -> (run, 0) -> (tarjanSort, 1) -> (idList, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2) -> (getWarnings, 0) -> (loginRun, 4)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Get, 1) -> (Pointer, 1) -> (NewConfig, 2) -> (ParseRequestURI, 1) -> (CheckPersistence, 2) -> (Observe, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (parseURL, 1) -> (Split, 2) -> (Add, 2) -> (GetFlags, 0) -> (closeConnection, 0) -> (reConnectToRoute, 1) -> (removeFromCache, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2) -> (getWarnings, 0) -> (loginRun, 4) -> (f, 0) -> (sasl_errdetail, 1) -> (syncServersIteration, 1) -> (logf, 1) -> (add, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2) -> (Unmarshal, 3) -> (syncServersIteration, 1) -> (logf, 1) -> (add, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3) -> (Validate, 0) -> (ReplaceAllStringFunc, 2)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (Next, 0) -> (run, 0) -> (tarjanSort, 1) -> (idList, 1) -> (C, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Get, 1) -> (Pointer, 1) -> (NewConfig, 2) -> (ParseRequestURI, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2) -> (getWarnings, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewConfigCache, 0) -> (Init, 0) -> (Error, 3) -> (Second, 0) -> (addRoute, 3)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (startLogger, 0) -> (WriteMsg, 2) -> (SendMail, 5) -> (DoRotate, 0) -> (deleteOldLog, 0)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (parseURL, 1) -> (Split, 2) -> (Add, 2) -> (GetFlags, 0) -> (closeConnection, 0) -> (reConnectToRoute, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (NewTipManager, 0) -> (Init, 0) -> (Error, 3)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Trace, 2) -> (AddTimeIncrement, 1) -> (add, 2) -> (AddInt64, 2) -> (Next, 0) -> (run, 0) -> (tarjanSort, 1)
(processActionMsg, 1) -> (Broadcast, 1) -> (Debug, 3) -> (Log, 3) -> (Error, 2) -> (New, 1) -> (Stack, 0) -> (SendShutdownSignal, 0) -> (Close, 0) -> (removeClient, 1) -> (removeClient, 1) -> (removeSocket, 2)

```

Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.

commit ID: c5176485339a69271b83a23982801a67b443c7c1

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.