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

create session failed #210

Closed
m20082008m opened this issue Jun 17, 2022 · 8 comments
Closed

create session failed #210

m20082008m opened this issue Jun 17, 2022 · 8 comments
Labels
type/question Type: question about the product

Comments

@m20082008m
Copy link

when my client request nebula server for long time, it return error for session

fail to authenticate, error: Create session failed: Unknown error!

nebula-storaged v2.6.1
nebula-graphd v2.6.1
nebula-metad v2.6.1
nebula-graph-studio v3.1.0
nebula-http-gateway v2.1.1
nebula-go v2.6.0

metad warning logs

W0614 05:04:45.844468   107 SessionManagerProcessor.cpp:56] Session id `1655183124722335' not found
W0614 05:09:06.080336   105 SessionManagerProcessor.cpp:56] Session id `1655183384989427' not found
W0614 05:19:56.704413   108 SessionManagerProcessor.cpp:56] Session id `1655184035640282' not found
W0614 05:21:06.777271   106 SessionManagerProcessor.cpp:56] Session id `1655184105714553' not found
W0614 05:21:46.824519   105 SessionManagerProcessor.cpp:56] Session id `1655184145761765' not found
W0614 05:24:47.016147   108 SessionManagerProcessor.cpp:56] Session id `1655184325959818' not found
W0614 05:25:07.037206   105 SessionManagerProcessor.cpp:56] Session id `1655184345977612' not found
W0614 05:27:07.169456   107 SessionManagerProcessor.cpp:56] Session id `1655184466088790' not found
W0614 05:34:07.615229   107 SessionManagerProcessor.cpp:56] Session id `1655184886565665' not found
W0614 05:36:17.764503   108 SessionManagerProcessor.cpp:56] Session id `1655185016713685' not found

graphd warning logs

E0614 05:24:47.016408    16 GraphSessionManager.cpp:205] Update sessions failed: Session not existed!
E0614 05:24:47.016480    18 GraphSessionManager.cpp:229] Update sessions failed: Update sessions failed: Session not existed!
E0614 05:25:07.037410    13 GraphSessionManager.cpp:205] Update sessions failed: Session not existed!
E0614 05:25:07.037528    18 GraphSessionManager.cpp:229] Update sessions failed: Update sessions failed: Session not existed!
E0614 05:27:07.169734    15 GraphSessionManager.cpp:205] Update sessions failed: Session not existed!
E0614 05:27:07.169849    18 GraphSessionManager.cpp:229] Update sessions failed: Update sessions failed: Session not existed!
E0614 05:34:07.615523    15 GraphSessionManager.cpp:205] Update sessions failed: Session not existed!
E0614 05:34:07.615622    18 GraphSessionManager.cpp:229] Update sessions failed: Update sessions failed: Session not existed!
E0614 05:36:17.764770    15 GraphSessionManager.cpp:205] Update sessions failed: Session not existed!
E0614 05:36:17.764878    18 GraphSessionManager.cpp:229] Update sessions failed: Update sessions failed: Session not existed!

i restart my client can solve the problem,

@wey-gu
Copy link

wey-gu commented Jun 20, 2022

@Aiee could you please help advise on this? Did the session expire or?

@Aiee
Copy link
Contributor

Aiee commented Jun 20, 2022

@m20082008m Could you show us the code on how you use the client? It seems you create a new session for each query. The error is caused by the inconsistency session info of graph layer and meta layer.

@m20082008m
Copy link
Author

#184
i can't share global session for every request, so now i create a new session for each request

@m20082008m
Copy link
Author

// NewSession for db
func NewSession(cfg module.Config) (*nebula.Session, error) {
	// Create session
	session, err := GraphPool.GetSession(cfg.GraphDB.User, cfg.GraphDB.Password)
	if err != nil {
		return nil, common.GeneralDetailError("Init graph db session error",
			codes.Internal, pb.ServiceCode_GRAPHDB_SESSION_INIT)
	}
	// Prepare the query
	initSchema := "USE " + cfg.GraphDB.Database + " ; "
	// Excute a query
	if err := tryToExecute(session, initSchema, func(resp *nebula.ResultSet) error {
		if !resp.IsSucceed() {
			return fmt.Errorf("%d %s", resp.GetErrorCode(), resp.GetErrorMsg())
		}

		return nil
	}); err != nil {
		return nil, transformError(err)
	}

	return session, err
}
	session, err := model.NewSession(module.DefaultConfig)
	if err != nil {
		return common.GeneralError("init graph db session error"+err.Error(), codes.Internal)
	}
	// Release session and return connection back to connection pool
	defer session.Release()
        gql := fmt.Sprintf(`FETCH PROP ON * '%s' yield id($$)`, strings.Join(stations, "','"))
	data := make([]struct {
		VID string `json:"VertexID"`
	}, 0)
	_, err = model.QueryGQL(session, gql, &data)
	if err != nil {
		return common.GeneralError(err.Error(), codes.Internal)
	}

@HarrisChu
Copy link
Contributor

image

if every query create a new session, there may be two same session in meta, and if one release session, the other doesn't work well.

@m20082008m
Copy link
Author

oh, i see. how to solve the problem? such as init a session pool?

@HarrisChu
Copy link
Contributor

yes, session pool could

@Sophie-Xie Sophie-Xie added the type/question Type: question about the product label Nov 30, 2022
@QingZ11
Copy link

QingZ11 commented Jan 29, 2023

@m20082008m hi, I have noticed that the issue you created hasn’t been updated for nearly a month, is this issue been resolved? If not resolved, can you provide some more information? If solved, can you close this issue?

Thanks a lot for your contribution anyway 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question Type: question about the product
Projects
None yet
Development

No branches or pull requests

6 participants