port_driver_destroy_cb is never called and only appears in tests
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- c, erlang
- Lĩnh vực
- embedded-iot
Hướng nghiên cứu
Read src/platforms/esp32/test/main/test_main.c and the app_main() entry points in src/platforms/esp32/main.c and src/platforms/rp2/src/main.c, then trace port_driver_destroy_all and nif_collection_destroy_all in the named source files. Check which cleanup calls belong at shutdown in each platform and how the existing driver cleanup tests cover them. Done means the ESP32 and RP2 shutdown paths perform the intended cleanup and relevant tests pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
port_driver_destroy_cb is a field of PortDriverDef in portnifloader.h that is set to the DESTROY_CB parameter by the REGISTER_PORT_DRIVER macro.
The field is used by the port_driver_destroy_all functions in src/libAtomVM/portnifloader.c and src/platforms/rp2/src/lib/sys.c
port_driver_driver_destroy_all is only called in src/platforms/esp32/test/main/test_main.c
It is never called in actual code.
I believe it is meant to do global cleanup of all the instances or ports of the driver.
Very few of the drivers in the esp32 tree use the destroy callback, but it is still used in a few drivers such as socket_driver.c
My driver can do cleanup with a "close" mailbox action, but I still think a driver-wide cleanup like you have in your design makes sense in case there is any other driver-wide shutdown needed or as a fallback to get the hardware to a sane state if mailbox messages aren't delivered.
test_main.c shows a pattern for how it could be inserted into src/platforms/esp32/main.c:app_main() at the end.
The RP2 tree also may need to call it in src/platforms/rp2/src/main.c:app_main()
nif_collection_destroy_all isn't called in the ESP32 tree either, but it is called in RP2.
Or maybe I'm missing something and these functions are called elsewhere.
It looks like a possibly smart API design sign, just a mistake in not calling it. I can write a PR to add those missing calls if needed, let me know. It might need a lot of testing since it is an unused code path that some drivers implement but haven't tested.
- Ngôn ngữ chính
- Erlang
- Star
- 2.3k
- Fork
- 171
- Merge trung bình
- 5 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của atomvm/AtomVM
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
atomvm/AtomVM#2435 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
atomvm/AtomVM#2429 · 1 reaction ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của atomvm/AtomVM
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Crash in mdns componentĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
openvehicles/Open-Vehicle-Monitoring-System-3#1575 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
betrusted-io/xous-core#1019 ·
-
Component:APU Status:New Type:Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
openhwfoundation/cva6#3734 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
lowRISC/ibex-demo-system#157 ·