create session failed
m20082008m opened this issue · 8 comments
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,
@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.
#184
i can't share global session for every request, so now i create a new session for each request
// 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)
}
oh, i see. how to solve the problem? such as init a session pool?
yes, session pool could
@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 😊