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

Fixed hanging test #334

Merged
merged 1 commit into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion agent/tekagent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func run() error {
fmt.Println(fmt.Sprintf("signal: '%s' received. tektite agent will stop", sig.String()))
// hard stop if server Stop() hangs
tz := time.AfterFunc(30*time.Second, func() {
common.DumpStacks()
fmt.Println("tektite agent stop did not complete in time. system will exit")
common.DumpStacks()
swg.Done()
os.Exit(1)
})
Expand Down
1 change: 0 additions & 1 deletion integ/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ func FetchMessages(maxMessages int, timeout time.Duration, consumer Consumer) ([
for i := 0; i < maxMessages; i++ {
msg, err := consumer.Fetch(timeout)
if err != nil {
log.Errorf("err is %v", err)
return nil, err
}
if msg == nil {
Expand Down
1 change: 0 additions & 1 deletion integ/produce_consume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ func testProduceConsume(t *testing.T, producerFactory ProducerFactory, consumerF
}()

received, err := FetchMessages(numMessages, 5*time.Second, consumer)
log.Errorf("err is %v", err)
require.NoError(t, err)

SortMessagesByKey(received)
Expand Down
4 changes: 2 additions & 2 deletions sockserver/socket_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ func (s *SocketServer) Start() error {
if s.started {
return nil
}
s.acceptLoopExitGroup.Add(1)
list, err := s.createNetworkListener()
if err != nil {
return err
}
s.listener = list
s.started = true
s.acceptLoopExitGroup.Add(1)
common.Go(s.acceptLoop)
return nil
}
Expand Down Expand Up @@ -148,8 +148,8 @@ func (s *SocketServer) acceptLoop() {
conn: conn,
userConn: s.connFactory(conn),
}
s.connections.Store(c, struct{}{})
c.start()
s.connections.Store(c, struct{}{})
}
}

Expand Down
9 changes: 5 additions & 4 deletions transport/socket_transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ It can also be configured to use TLS.
*/
type SocketTransportServer struct {
lock sync.RWMutex
handlersLock sync.RWMutex
handlers map[int]RequestHandler
socketServer *sockserver.SocketServer
idSequence int64
Expand Down Expand Up @@ -62,8 +63,8 @@ func (s *SocketTransportServer) Stop() error {
}

func (s *SocketTransportServer) RegisterHandler(handlerID int, handler RequestHandler) bool {
s.lock.Lock()
defer s.lock.Unlock()
s.handlersLock.Lock()
defer s.handlersLock.Unlock()
_, exists := s.handlers[handlerID]
if exists {
return false
Expand All @@ -76,8 +77,8 @@ func (s *SocketTransportServer) Address() string {
}

func (s *SocketTransportServer) getRequestHandler(handlerID int) (RequestHandler, bool) {
s.lock.RLock()
defer s.lock.RUnlock()
s.handlersLock.RLock()
defer s.handlersLock.RUnlock()
handler, exists := s.handlers[handlerID]
return handler, exists
}
Expand Down
Loading