-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
esp8266: Crashes on concurrent WebREPL access #2537
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
Comments
If you're interested to have progress with this sooner rather than later, please build the latest master (requires latest esp-open-sdk), and see if the issue still persists. If it does, please attach firmware.bin, firmware.elf, firmware.map files for investigation. Thanks. |
Hi with the current sdk and the latest micropython src I still get the same issue. Scenario 1:import webrepl no other actions on the esp Scenario 2:same as 1 but now with => The webrepl filetransfer breaks after the 2. or 3. time of transfering ESP serial output:Fatal exception 9(LoadStoreAlignmentCause): ets Jan 8 2013,rst cause:2, boot mode:(3,0) load 0x40100000, len 32020, room 16 MicroPython v1.8.5-18-g84679e0 on 2016-10-20; ESP module with ESP8266 FirmwareLINK build/firmware.elf |
Thanks for detailed steps to reproduce. Well, first of all, concurrent webrepl connections aren't supported - you can have only one connection. I guess it's time to actually add check for that. Otherwise, the exception above looks pretty weird - it's for unaligned access to a stack variable, something which should not ever happen. It would be nice to understand ins and outs of that, but general issue would be trying to run code concurrently which was not intended for that. |
Hi pfalcon, the webrepl connections aren't parallel. They happen sequencially and after the 2. oder 3. transfer the error happens |
Ok, so can you please provide exact steps required to reproduce the issue, as 1-2-3... ? |
@pfalcon I'm sorry, for the delay and that the change didn't solved the problem. Only the count of retries has increased. So after the 10. time of sending the same file to the esp the esp crashes with: Fatal exception 9(LoadStoreAlignmentCause): ets Jan 8 2013,rst cause:2, boot mode:(3,6) load 0x40100000, len 32020, room 16 MicroPython v1.8.5-42-gb78144c on 2016-10-24; ESP module with ESP8266 |
Thanks. I'd need exact list of steps to reproduce it:
, to avoid any confusion. Thanks. |
Not defined count of webrepl data sendSometimes it breaks after the 2. iteration sometime it breaks first after the 8. interation of webrepl. So I can't give you any deterministic count of steps, sry :-( |
Does this still happen? There were no similar reports from anybody else. Please retest. |
I looked into this issue. I could reproduce it with v1.9.4 of MicroPython. The steps were as described above, and I was able to add a delay to the printing loop like this: >>> while 1:
... 1+1
... time.sleep_ms(100) That would still lead to a crash. But note that that code must be typed in at the normal REPL (and not paste mode!) to reproduce the issue. The bug ended up being random values written to the stack due to The fix is to make sure that --- a/extmod/uos_dupterm.c
+++ b/extmod/uos_dupterm.c
@@ -94,13 +94,13 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) {
if (MP_STATE_VM(dupterm_objs[idx]) == MP_OBJ_NULL) {
continue;
}
+ mp_obj_array_t *arr = MP_OBJ_TO_PTR(MP_STATE_VM(dupterm_arr_obj));
+ void *org_items = arr->items;
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
mp_obj_t write_m[3];
mp_load_method(MP_STATE_VM(dupterm_objs[idx]), MP_QSTR_write, write_m);
- mp_obj_array_t *arr = MP_OBJ_TO_PTR(MP_STATE_VM(dupterm_arr_obj));
- void *org_items = arr->items;
arr->items = (void*)str;
arr->len = len;
write_m[2] = MP_STATE_VM(dupterm_arr_obj);
@@ -110,6 +110,8 @@ void mp_uos_dupterm_tx_strn(const char *str, size_t len) {
arr->len = 1;
nlr_pop();
} else {
+ arr->items = org_items;
+ arr->len = 1;
mp_uos_deactivate(idx, "dupterm: Exception in write() method, deactivating: ", nlr.ret_val);
}
} But it's no longer an issue in the latest MicroPython because commit 0359064 removed the need for the In summary: the bug was there but it has been fixed already by 0359064 (so v1.10 is the oldest release with the fix). |
Hi I want to program my EPS8266 micropython via the webrepl during it executes scripts via wifi.
I don't want to use a wire for just updating a script
System
MicroPython v1.8.5 on 2016-10-18; ESP module with ESP8266
What I've observed
micropython program
import webrepl
webrepl.start(password='')
while True:
print('1')
Host
Sending a file test.py via webrepl
(dd if=/dev/zero of=test.py bs=1K count=1) or (dd if=/dev/zero of=test.py bs=512 count=1)
./webrepl_cli.py test.py 192.168.4.1:/test.py
2 reactions on the esp (eventually)
dupterm: EOF received, deactivating
dupterm: Exception in write() method, deactivating: OSError: [Errno 9] EBADF
Fatal exception 28(LoadProhibitedCause):
epc1=0x40245962, epc2=0x00000000, epc3=0x00000000, excvaddr=0x00000000, depc=0x00000000
Fatal exception 9(LoadStoreAlignmentCause):
epc1=0x40253ad0, epc2=0x00000000, epc3=0x00000000, excvaddr=0x3ffff757, depc=0x00000000
ets Jan 8 2013,rst cause:2, boot mode:(3,0)
The text was updated successfully, but these errors were encountered: