Skip to content

never updates , causing incorrect running-state reporting and a false "service has not been started" message in  #204

@d1zzy126

Description

@d1zzy126

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions