[PR #548] [MERGED] chore: init listener first avoid panic error #574

Closed
opened 2026-02-16 01:16:22 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langgenius/dify-plugin-daemon/pull/548
Author: @fatelei
Created: 12/22/2025
Status: Merged
Merged: 12/22/2025
Merged by: @Yeuoly

Base: mainHead: panic


📝 Commits (1)

  • 7a327ab chore: init listener first avoid panic error

📊 Changes

1 file changed (+3 additions, -6 deletions)

View changed files

📝 internal/core/local_runtime/instance.go (+3 -6)

📄 Description

Description

fix #29959, init listener first to avoid panic error

func(sessionId string, data []byte) {
    // FIX: avoid deadlock to plugin invoke
    s.l.Lock()
    listener := s.listener[sessionId]
    s.l.Unlock()
    if listener != nil {
        listener(data)
    }
}

if the listener is nil, it will panic, so init listener first

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Performance improvement
  • Other

Essential Checklist

Testing

  • I have tested the changes locally and confirmed they work as expected
  • I have added unit tests where necessary and they pass successfully

Bug Fix (if applicable)

  • I have used GitHub syntax to close the related issue (e.g., Fixes #123 or Closes #123)

Additional Information

Please provide any additional context that would help reviewers understand the changes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langgenius/dify-plugin-daemon/pull/548 **Author:** [@fatelei](https://github.com/fatelei) **Created:** 12/22/2025 **Status:** ✅ Merged **Merged:** 12/22/2025 **Merged by:** [@Yeuoly](https://github.com/Yeuoly) **Base:** `main` ← **Head:** `panic` --- ### 📝 Commits (1) - [`7a327ab`](https://github.com/langgenius/dify-plugin-daemon/commit/7a327abc2270fcbf164b00396660d0565a0e2405) chore: init listener first avoid panic error ### 📊 Changes **1 file changed** (+3 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `internal/core/local_runtime/instance.go` (+3 -6) </details> ### 📄 Description ## Description fix #29959, init listener first to avoid panic error ```go func(sessionId string, data []byte) { // FIX: avoid deadlock to plugin invoke s.l.Lock() listener := s.listener[sessionId] s.l.Unlock() if listener != nil { listener(data) } } ``` if the listener is nil, it will panic, so init listener first ## Type of Change - [x] Bug fix - [ ] New feature - [ ] Refactor - [ ] Performance improvement - [ ] Other ## Essential Checklist ### Testing - [x] I have tested the changes locally and confirmed they work as expected - [ ] I have added unit tests where necessary and they pass successfully ### Bug Fix (if applicable) - [x] I have used GitHub syntax to close the related issue (e.g., `Fixes #123` or `Closes #123`) ## Additional Information Please provide any additional context that would help reviewers understand the changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 01:16:22 -05:00
yindo closed this issue 2026-02-16 01:16:22 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-plugin-daemon#574