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

server_handler.go OnMessage pkg is judge false #457

Closed
cityiron opened this issue Jul 24, 2022 · 3 comments
Closed

server_handler.go OnMessage pkg is judge false #457

cityiron opened this issue Jul 24, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@cityiron
Copy link
Contributor

What happened:

When run dubbo2http samples use develop branch, will hit error log like follow code:

	decodeResult, drOK := pkg.(remoting.DecodeResult)
	if !drOK {
		logger.Errorf("illegal package{%#v}", pkg)
		return
	}

this pkg object is *remoting.DecodeResult

What you expected to happen:

drOk will true, and run continue.

How to reproduce it (as minimally and precisely as possible):

Just run pixiu, samples/dubbohttpproxy/server/http/server.go, and run dubbo2http_test.go.

@cityiron cityiron changed the title server_handler.go OnMessage pkg is change false server_handler.go OnMessage pkg is judge false Jul 24, 2022
@cityiron cityiron added the bug Something isn't working label Jul 24, 2022
@cityiron
Copy link
Contributor Author

Just change to

	decodeResult, drOK := pkg.(*remoting.DecodeResult)
	if !drOK {
		logger.Errorf("illegal package{%#v}", pkg)
		return
	}

, run success.

@kaori-seasons
Copy link
Contributor

i want to try to fix it

@kaori-seasons
Copy link
Contributor

kaori-seasons commented Jul 26, 2022

I have reproduced the problem according to the steps you gave, and found that the current version does not perform heartbeat detection on the session, which is fixed in dubbo-go@v3. The code snippet is:

decodeResult, drOK := pkg.(*remoting.DecodeResult)
	if !drOK || decodeResult == ((*remoting.DecodeResult)(nil)) {
		logger.Errorf("illegal package{%#v}", pkg)
		return
	}
	if !decodeResult.IsRequest {
		res := decodeResult.Result.(*remoting.Response)
		if res.Event {
			logger.Debugf("get rpc heartbeat response{%#v}", res)
			if res.Error != nil {
				logger.Errorf("rpc heartbeat response{error: %#v}", res.Error)
			}
			res.Handle()
			return
		}
		logger.Errorf("illegal package but not heartbeat. {%#v}", pkg)
		return
	}
	req := decodeResult.Result.(*remoting.Request)

see code: https://github.com/apache/dubbo-go/blob/1e82194facaf976c29c14ac92df94deacc89ff1c/remoting/getty/listener.go#L95

Maybe we can refer here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants