SAY-5 30b7814aaf pkg/tools/batcher: stop scheduler panicking when b.data is closed externally
scheduler()'s defer unconditionally calls close(b.data). If the channel
was closed by the caller (or an upstream producer) instead of via the
normal Close()-sends-nil path, the receive on b.data returns ok == false,
scheduler returns, and the deferred close(b.data) then fires on an
already-closed channel:

    panic: close of closed channel

reliably reproducible under the #3653 steps (manually closing b.data
while Start() is running).

Track whether we observed the external-close via a local
`externallyClosed` flag set in the `ok == false` branch. The defer
only closes b.data when that flag is false, i.e. when the scheduler
exited through the nil-message or ticker paths and still owns the
channel. No behaviour change on the graceful Close() path.

Fixes #3653
2026-04-20 03:08:42 -07:00
2025-11-25 08:23:22 +00:00
2025-06-11 08:29:44 +00:00
2025-11-25 08:23:22 +00:00
2025-07-28 02:46:23 +00:00
2025-11-25 08:23:22 +00:00
2024-04-24 12:11:24 +08:00
2024-04-22 16:31:11 +08:00
2024-07-16 02:46:21 +00:00
2025-04-22 16:48:12 +08:00
2024-04-24 12:11:24 +08:00
2023-07-10 18:19:25 +08:00
2026-03-19 04:09:02 +00:00
2026-03-19 04:09:02 +00:00
2025-07-28 02:46:23 +00:00
2025-04-22 21:47:13 +08:00
2026-03-19 04:09:02 +00:00
2025-07-28 02:46:23 +00:00

👥 Join Our Community

Ⓜ️ About OpenIM

Unlike standalone chat applications such as Telegram, Signal, and Rocket.Chat, OpenIM offers an open-source instant messaging solution designed specifically for developers rather than as a directly installable standalone chat app. Comprising OpenIM SDK and OpenIM Server, it provides developers with a complete set of tools and services to integrate instant messaging functions into their applications, including message sending and receiving, user management, and group management. Overall, OpenIM aims to provide developers with the necessary tools and framework to implement efficient instant messaging solutions in their applications.

App-OpenIM Relationship

🚀 Introduction to OpenIMSDK

OpenIMSDK, designed for OpenIMServer, is an IM SDK created specifically for integration into client applications. It supports various functionalities and modules:

  • 🌟 Main Features:

    • 📦 Local Storage
    • 🔔 Listener Callbacks
    • 🛡️ API Wrapping
    • 🌐 Connection Management
  • 📚 Main Modules:

    1. 🚀 Initialization and Login
    2. 👤 User Management
    3. 👫 Friends Management
    4. 🤖 Group Functions
    5. 💬 Session Handling

Built with Golang and supports cross-platform deployment to ensure a consistent integration experience across all platforms.

👉 Explore the GO SDK

🌐 Introduction to OpenIMServer

  • OpenIMServer features include:
    • 🌐 Microservices Architecture: Supports cluster mode, including a gateway and multiple rpc services.
    • 🚀 Diverse Deployment Options: Supports source code, Kubernetes, or Docker deployment.
    • Massive User Support: Supports large-scale groups with hundreds of thousands, millions of users, and billions of messages.

Enhanced Business Functions:

  • REST API: Provides a REST API for business systems to enhance functionality, such as group creation and message pushing through backend interfaces.

  • Webhooks: Expands business forms through callbacks, sending requests to business servers before or after certain events.

    Overall Architecture

🚀 Quick Start

Experience online for iOS/Android/H5/PC/Web:

👉 OpenIM Online Demo

To facilitate user experience, we offer various deployment solutions. You can choose your preferred deployment method from the list below:

System Support

Supports Linux, Windows, Mac systems, and ARM and AMD CPU architectures.

✍️ How to Contribute

We welcome contributions of any kind! Please make sure to read our Contributor Documentation before submitting a Pull Request.

Thank you for contributing to building a powerful instant messaging solution!

📕 License

This software is licensed under the Apache License 2.0

🔮 Thanks to our contributors!

Languages
Go 97.4%
Shell 1.4%
Dockerfile 1.2%