Alanxtl opened a new issue, #3237:
URL: https://github.com/apache/dubbo-go/issues/3237

   ### ✅ 验证清单
   
   - [x] 🔍 我已经搜索过 [现有 
Issues](https://github.com/apache/dubbo-go/issues),确信这不是重复问题
   
   ### 🚀 Go 版本
   
   1.24.0
   
   ### 📦 Dubbo-go 版本
   
   latest
   
   ### 🖥️ 服务端配置
   
   _No response_
   
   ### 💻 客户端配置
   
   _No response_
   
   ### 🌐 协议配置
   
   _No response_
   
   ### 📋 注册中心配置
   
   _No response_
   
   ### 💾 操作系统
   
   🪟 Windows
   
   ### 📝 Bug 描述
   
   1
   
   ### 🔄 重现步骤
   
   目前`server/server.go`的代码是这样的
   
   ```go
   func (s *Server) Serve() error {
        s.mu.Lock()
        defer s.mu.Unlock()
        if s.serve {
                return errors.New("server has already been started")
        }
        // prevent multiple calls to Serve
        s.serve = true
        // the registryConfig in ServiceOptions and ServerOptions all need to 
init a metadataReporter,
        // when ServiceOptions.init() is called we don't know if a new registry 
config is set in the future use serviceOption
        if err := metadata.InitRegistryMetadataReport(s.cfg.Registries); err != 
nil {
                return err
        }
        metadataOpts := metadata.NewOptions(
                metadata.WithAppName(s.cfg.Application.Name),
                metadata.WithMetadataType(s.cfg.Application.MetadataType),
                metadata.WithPort(getMetadataPort(s.cfg)),
                
metadata.WithMetadataProtocol(s.cfg.Application.MetadataServiceProtocol),
        )
        if err := metadataOpts.Init(); err != nil {
                return err
        }
   
        if err := s.exportServices(); err != nil {
                return err
        }
        if err := s.exportInternalServices(); err != nil {
                return err
        }
        if err := exposed_tmp.RegisterServiceInstance(); err != nil {
                return err
        }
   
        select {}
   }
   ```
   
   defer s.mu.Unlock() 永远不会被触发
   
   任何后续调用 `GetServiceOptions()`、`GetServiceInfo()`、`registerServiceOptions()` 
的代码都会死锁。
   
   建议:`serve = true` 的赋值在锁内完成后立即释放锁,再进入阻塞等待。
   
   
   ### ✅ 预期行为
   
   1
   
   ### ❌ 实际行为
   
   1
   
   ### 💡 可能的解决方案
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to