Fix: Add -admin.grpc flag to worker for explicit gRPC port (#7926) (#7927)

* Fix: Add -admin.grpc flag to worker for explicit gRPC port configuration

* Fix(helm): Add adminGrpcServer to worker configuration

* Refactor: Support host:port.grpcPort address format, revert -admin.grpc flag

* Helm: Conditionally append grpcPort to worker admin address

* weed/admin: fix "send on closed channel" panic in worker gRPC server

Make unregisterWorker connection-aware to prevent closing channels
belonging to newer connections.

* weed/worker: improve gRPC client stability and logging

- Fix goroutine leak in reconnection logic
- Refactor reconnection loop to exit on success and prevent busy-waiting
- Add session identification and enhanced logging to client handlers
- Use constant for internal reset action and remove unused variables

* weed/worker: fix worker state initialization and add lifecycle logs

- Revert workerState to use running boolean correctly
- Prevent handleStart failing by checking running state instead of startTime
- Add more detailed logs for worker startup events
This commit is contained in:
Chris Lu
2025-12-31 11:55:09 -08:00
committed by GitHub
parent 5a135f8c5a
commit 31a4f57cd9
7 changed files with 146 additions and 69 deletions

View File

@@ -195,7 +195,7 @@ func NewWorker(config *types.WorkerConfig) (*Worker, error) {
func (w *Worker) managerLoop() {
w.state = &workerState{
startTime: time.Now(),
running: false,
stopChan: make(chan struct{}),
currentTasks: make(map[string]*types.TaskInput),
}
@@ -428,6 +428,7 @@ func (w *Worker) Start() error {
// Start starts the worker
func (w *Worker) handleStart(cmd workerCommand) {
glog.Infof("Worker %s handleStart called", w.id)
if w.state.running {
cmd.resp <- fmt.Errorf("worker is already running")
return