NeugDBService has a running_ atomic that is consulted by IsRunning(), service_status(), and Stop(), but that state is never updated on successful start or stop. As a result, Stop() can immediately print NeugDB service has not been started! right after a successful serve(), and the service's internal running-state reporting is inconsistent with reality.
Environment
- NeuG: 0.1.0
- mode: Python
Database.serve() / stop_serving() path and corresponding C++ service layer
- platform: Linux x86_64
Reproduction
from neug.database import Database
db = Database("", "w")
db.serve(19001, "127.0.0.1", False)
db.stop_serving()
db.close()
Expected
After a successful serve(), the service should be considered running. IsRunning() and service_status() should reflect that state, and stop_serving() should not claim the service was never started.
Actual
Immediately after a successful serve(), the stop path emits:
NeugDB service has not been started!
Source inspection shows that NeugDBService has a running_ atomic used by IsRunning(), service_status(), and Stop(), but Start() and Stop() never set or clear it, so IsRunning() remains false throughout the service lifetime.
In my local validation, the service still does stop successfully at the transport level, so this is not a "server cannot be stopped" bug. It is a real state-machine / status-reporting bug: the implementation's internal running-state contract is broken, which produces false status messages and makes IsRunning()-based logic unreliable.
Evidence
- the false message is reproducible immediately after a successful
serve()
running_ exists in the service object but has no state transitions in Start() / Stop()
IsRunning() returns running_, not the underlying BRPC server state
- the affected field is declared in
include/neug/server/neug_db_service.h
service_status() also uses IsRunning()
- the false branch is reached in
src/server/neug_db_service.cc
Relevant code
running_ field: include/neug/server/neug_db_service.h
IsRunning() returns running_: src/server/neug_db_service.cc
service_status() uses IsRunning(): src/server/neug_db_service.cc
Start() does not set running_ = true: src/server/neug_db_service.cc
Stop() checks IsRunning() and prints the false message: src/server/neug_db_service.cc
Impact
This is smaller than a hard functional shutdown failure, but it is still a real bug because it breaks the service's own state semantics.
Any code that relies on:
IsRunning()
service_status()
- the absence of stop-time error messages
can be misled about the true service state. It also makes debugging service lifecycle issues harder because the log output contradicts the actual control flow.
NeugDBServicehas arunning_atomic that is consulted byIsRunning(),service_status(), andStop(), but that state is never updated on successful start or stop. As a result,Stop()can immediately printNeugDB service has not been started!right after a successfulserve(), and the service's internal running-state reporting is inconsistent with reality.Environment
Database.serve()/stop_serving()path and corresponding C++ service layerReproduction
Expected
After a successful
serve(), the service should be considered running.IsRunning()andservice_status()should reflect that state, andstop_serving()should not claim the service was never started.Actual
Immediately after a successful
serve(), the stop path emits:Source inspection shows that
NeugDBServicehas arunning_atomic used byIsRunning(),service_status(), andStop(), butStart()andStop()never set or clear it, soIsRunning()remains false throughout the service lifetime.In my local validation, the service still does stop successfully at the transport level, so this is not a "server cannot be stopped" bug. It is a real state-machine / status-reporting bug: the implementation's internal running-state contract is broken, which produces false status messages and makes
IsRunning()-based logic unreliable.Evidence
serve()running_exists in the service object but has no state transitions inStart()/Stop()IsRunning()returnsrunning_, not the underlying BRPC server stateinclude/neug/server/neug_db_service.hservice_status()also usesIsRunning()src/server/neug_db_service.ccRelevant code
running_field:include/neug/server/neug_db_service.hIsRunning()returnsrunning_:src/server/neug_db_service.ccservice_status()usesIsRunning():src/server/neug_db_service.ccStart()does not setrunning_ = true:src/server/neug_db_service.ccStop()checksIsRunning()and prints the false message:src/server/neug_db_service.ccImpact
This is smaller than a hard functional shutdown failure, but it is still a real bug because it breaks the service's own state semantics.
Any code that relies on:
IsRunning()service_status()can be misled about the true service state. It also makes debugging service lifecycle issues harder because the log output contradicts the actual control flow.