🚨 Critical Issue #76: SocketBox Method Call Deadlock Investigation
## 🎯 Problem Identification Complete - SocketBox method calls (bind, isServer, toString) cause infinite blocking - Root cause: Method resolution pipeline deadlock before execute_socket_method - Other Box types (ArrayBox, StringBox, MapBox) work normally - Arc<Mutex> reference sharing confirmed working (Arc addresses match = true) ## 🔧 Debug Infrastructure Added - Comprehensive debug logging in socket_box.rs (bind, isServer, clone, toString) - Method call tracing in http_methods.rs - Deadlock detection points identified at interpreter expressions.rs:462-464 ## 📋 Issue #76 Created for Copilot Investigation - Systematic root cause analysis requirements (Architecture→Parser→Runtime levels) - Comprehensive test cases: minimal/comprehensive/comparison scenarios - Strict prohibition of band-aid fixes - architectural analysis required - Hypothesis: Multiple Arc<Mutex> combinations causing circular deadlock ## 🧪 Test Suite Added - test_socket_deadlock_minimal.nyash: Minimal reproduction case - test_socket_methods_comprehensive.nyash: All methods deadlock verification - test_other_boxes_working.nyash: Normal Box operation confirmation - SOCKETBOX_ISSUE_REPRODUCTION.md: Complete reproduction guide ## 📊 Impact Assessment - Phase 9 HTTP server implementation completely blocked - SocketBox functionality entirely non-functional - Critical blocker for production readiness - Requires immediate systematic investigation 🔥 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@ -298,13 +298,13 @@ impl NyashInterpreter {
|
||||
|
||||
// 既存のフィールド値があればfini()を呼ぶ
|
||||
if let Some(old_field_value) = instance.get_field(field) {
|
||||
if let Some(old_instance) = old_field_value.as_any().downcast_ref::<InstanceBox>() {
|
||||
if let Some(old_instance) = (*old_field_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
let _ = old_instance.fini();
|
||||
finalization::mark_as_finalized(old_instance.box_id());
|
||||
}
|
||||
}
|
||||
|
||||
instance.set_field(field, val.clone_box())
|
||||
instance.set_field(field, Arc::from(val.clone_box()))
|
||||
.map_err(|e| RuntimeError::InvalidOperation { message: e })?;
|
||||
Ok(val)
|
||||
} else {
|
||||
@ -321,7 +321,7 @@ impl NyashInterpreter {
|
||||
message: "'this' is not bound in the current context".to_string(),
|
||||
})?;
|
||||
|
||||
if let Some(instance) = (**this_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
if let Some(instance) = (*this_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
// 🔥 Usage prohibition guard - check if instance is finalized
|
||||
if instance.is_finalized() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
@ -331,13 +331,13 @@ impl NyashInterpreter {
|
||||
|
||||
// 既存のthis.field値があればfini()を呼ぶ
|
||||
if let Some(old_field_value) = instance.get_field(field) {
|
||||
if let Some(old_instance) = old_field_value.as_any().downcast_ref::<InstanceBox>() {
|
||||
if let Some(old_instance) = (*old_field_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
let _ = old_instance.fini();
|
||||
finalization::mark_as_finalized(old_instance.box_id());
|
||||
}
|
||||
}
|
||||
|
||||
instance.set_field(field, val.clone_box())
|
||||
instance.set_field(field, Arc::from(val.clone_box()))
|
||||
.map_err(|e| RuntimeError::InvalidOperation { message: e })?;
|
||||
Ok(val)
|
||||
} else {
|
||||
@ -354,7 +354,7 @@ impl NyashInterpreter {
|
||||
message: "'this' is not bound in the current context".to_string(),
|
||||
})?;
|
||||
|
||||
if let Some(instance) = (**me_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
if let Some(instance) = (*me_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
// 🔥 Usage prohibition guard - check if instance is finalized
|
||||
if instance.is_finalized() {
|
||||
return Err(RuntimeError::InvalidOperation {
|
||||
@ -364,13 +364,13 @@ impl NyashInterpreter {
|
||||
|
||||
// 既存のme.field値があればfini()を呼ぶ
|
||||
if let Some(old_field_value) = instance.get_field(field) {
|
||||
if let Some(old_instance) = old_field_value.as_any().downcast_ref::<InstanceBox>() {
|
||||
if let Some(old_instance) = (*old_field_value).as_any().downcast_ref::<InstanceBox>() {
|
||||
let _ = old_instance.fini();
|
||||
finalization::mark_as_finalized(old_instance.box_id());
|
||||
}
|
||||
}
|
||||
|
||||
instance.set_field(field, val.clone_box())
|
||||
instance.set_field(field, Arc::from(val.clone_box()))
|
||||
.map_err(|e| RuntimeError::InvalidOperation { message: e })?;
|
||||
Ok(val)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user