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

feat(net): 实现inet socket资源释放 #990

Closed
2 tasks done
Samuka007 opened this issue Oct 17, 2024 · 6 comments · Fixed by #1086
Closed
2 tasks done

feat(net): 实现inet socket资源释放 #990

Samuka007 opened this issue Oct 17, 2024 · 6 comments · Fixed by #1086
Assignees
Labels
A-network Area: 网络子系统 enhancement New feature or request good first issue Good for newcomers

Comments

@Samuka007
Copy link
Member

Samuka007 commented Oct 17, 2024

目前仅实现了inet socket的port分配,但没有很好利用raii释放port资源。考虑引入结构实现inet port资源的获取与释放。

源码位于重构后的网络子系统:kernel/src/net/socket/inet/common/port.rs

  • 实现TCP Port释放
  • 实现UDP Port释放
@Samuka007 Samuka007 added enhancement New feature or request good first issue Good for newcomers A-network Area: 网络子系统 labels Oct 17, 2024
@Samuka007 Samuka007 self-assigned this Oct 17, 2024
@dragonosbot dragonosbot added the needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。 label Oct 17, 2024
@Samuka007 Samuka007 removed the needs-triage 这个问题可能需要分类处理。如果已经完成分类,请移除它。 label Oct 17, 2024
@ywh555hhh
Copy link

Can I try?

@fslongjin
Copy link
Member

Can I try?

@dragonos-community/sig-network

这个目前新的重构解决了吗?还是说,仍然存在这个问题?

@Samuka007
Copy link
Member Author

Can I try?

@DragonOS-Community/sig-network

这个目前新的重构解决了吗?还是说,仍然存在这个问题?

未解决的,是在新的重构中可以完善的地方!非常欢迎贡献~

@ywh555hhh
Copy link

Can I try?

@dragonos-community/sig-network

这个目前新的重构解决了吗?还是说,仍然存在这个问题?

准备演讲前还在 github 上回复我太 respect 了 @fslongjin

@Samuka007
Copy link
Member Author

Fix TCP in #1032

@Samuka007
Copy link
Member Author

Ctrl+C 结束进程后,再次访问原socket,中断会出错

[ ERROR ] (src/debug/panic/mod.rs:15)    Kernel Panic Occurred.                                                                                                                               
Location:                                                                                                                                                                                     
        File: src/net/socket/inet/stream/mod.rs                                                                                                                                               
        Line: 216, Column: 42                                                                                                                                                                 
Message:                                                                                                                                                                                      
        Tcp Inner is None                                                                                                                                                                     
Rust Panic Backtrace:                                                                                                                                                                         
function:_Unwind_RaiseException()       (+) 0066 address:0xffff8000002728a2                                                                                                                   
function:rust_begin_unwind()    (+) 0536 address:0xffff8000001dc1c8                                                                                                                           
function:core::panicking::panic_fmt()   (+) 0028 address:0xffff8000002eff8c                                                                                                                   
function:core::option::expect_failed()  (+) 0098 address:0xffff8000002eff62                                                                                                                   
function:dragonos_kernel::net::socket::inet::stream::TcpSocket::update_events()         (+) 0393 address:0xffff8000003548c9                                                                   
function:<dragonos_kernel::net::socket::inet::stream::TcpSocket as dragonos_kernel::net::socket::inet::InetSocket>::on_iface_events()   (+) 0025 address:0xffff8000003587c9                   
function:dragonos_kernel::driver::net::IfaceCommon::poll()      (+) 0597 address:0xffff80000034f2f5                                                                                           
function:dragonos_kernel::net::net_core::poll_ifaces()  (+) 0541 address:0xffff80000024fbad                                                                                                   
function:<dragonos_kernel::driver::net::virtio_net::VirtIONetDevice as dragonos_kernel::driver::virtio::VirtIODevice>::handle_irq()     (+) 0006 address:0xffff800000497086                   
function:<dragonos_kernel::driver::virtio::irq::DefaultVirtioIrqHandler as dragonos_kernel::exception::irqdesc::IrqHandler>::handle()   (+) 1284 address:0xffff8000003c4ad4                   
function:dragonos_kernel::exception::handle::do_handle_irq_event()      (+) 0604 address:0xffff800000447b2c                                                                                   
function:dragonos_kernel::exception::handle::handle_irq_event()         (+) 0151 address:0xffff800000447827                                                                                   
function:<dragonos_kernel::exception::handle::EdgeIrqHandler as dragonos_kernel::exception::irqdesc::IrqFlowHandler>::handle()  (+) 0897 address:0xffff800000447481                           
function:x86_64_do_irq()        (+) 0216 address:0xffff8000004caf88                                                                                                                           
Current PCB:                                                                                                                                                                                  
        ProcessControlBlock { pid: Pid(0), tgid: Pid(0), thread_pid: RwLock { lock: 0, data: UnsafeCell { .. } }, basic: RwLock { lock: 0, data: UnsafeCell { .. } }, preempt_count: 4, flags:
 LockFreeFlags { inner: (empty) }, worker_private: SpinLock { lock: false, data: UnsafeCell { .. } }, kernel_stack: RwLock { lock: 0, data: UnsafeCell { .. } }, syscall_stack: RwLock { lock:
 0, data: UnsafeCell { .. } }, sched_info: ProcessSchedulerInfo { on_cpu: AtomicProcessorId { container: 0 }, inner_locked: RwLock { lock: 0, data: UnsafeCell { .. } }, sched_stat: RwLock { 
lock: 0, data: UnsafeCell { .. } }, sched_policy: RwLock { lock: 0, data: UnsafeCell { .. } }, sched_entity: FairSchedEntity { load: LoadWeight { weight: 0, inv_weight: 0 }, deadline: 0, min
_deadline: 0, on_rq: None, exec_start: 0, sum_exec_runtime: 0, vruntime: 0, vlag: 0, slice: 750000, prev_sum_exec_runtime: 0, avg: SchedulerAvg { last_update_time: 0, load_sum: 0, runnable_s
um: 0, util_sum: 0, period_contrib: 0, load_avg: 0, runnable_avg: 0, util_avg: 0 }, parent: (Weak), depth: 0, self_ref: (Weak), cfs_rq: (Weak), my_cfs_rq: None, runnable_weight: 0, pcb: (Wea
k) }, on_rq: SpinLock { lock: false, data: UnsafeCell { .. } }, prio_data: RwLock { lock: 0, data: UnsafeCell { .. } } }, arch_info: SpinLock { lock: false, data: UnsafeCell { .. } }, sig_in
fo: RwLock { lock: 0, data: UnsafeCell { .. } }, sig_struct: SpinLock { lock: false, data: UnsafeCell { .. } }, exit_signal: SIGCHLD, parent_pcb: RwLock { lock: 0, data: UnsafeCell { .. } },
 real_parent_pcb: RwLock { lock: 0, data: UnsafeCell { .. } }, children: RwLock { lock: 0, data: UnsafeCell { .. } }, wait_queue: WaitQueue(SpinLock { lock: false, data: UnsafeCell { .. } })
, thread: RwLock { lock: 0, data: UnsafeCell { .. } }, fs: SpinLock { lock: false, data: UnsafeCell { .. } }, alarm_timer: SpinLock { lock: false, data: UnsafeCell { .. } }, robust_list: RwL
ock { lock: 0, data: UnsafeCell { .. } }, nsproxy: RwLock { lock: 0, data: UnsafeCell { .. } }, cred: SpinLock { lock: false, data: UnsafeCell { .. } }, self_ref: (Weak) }

@Samuka007 Samuka007 changed the title feat(net): 实现inet socket端口资源释放 feat(net): 实现inet socket资源释放 Dec 30, 2024
@Samuka007 Samuka007 linked a pull request Jan 22, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: 网络子系统 enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants