Asertion error

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
droidwarrior
Posts: 4
Joined: Mon Aug 07, 2017 6:11 pm

Asertion error

Post by droidwarrior » Tue Aug 15, 2017 5:46 am

Hi everyone,

An new to upython. By the moment Im getting stuck with this error:

assertion "0" failed: file "../py/../extmod/modussl_mbedtls.c", line 150, function: socket_new
abort() was called at PC 0x40136397 on core 0

I guess there is not response from the server, but again Im guessing.
Any directions recommended?


Regards,

stijn
Posts: 735
Joined: Thu Apr 24, 2014 9:13 am

Re: Asertion error

Post by stijn » Tue Aug 15, 2017 7:17 am

It's not a conection problem. Assertion errors are used mostly to indicate 'things which should never happen' which possibly translates in 'programmer mistakes'. In this case, there's a function mbedtls_ssl_setup which does not return 0 and that is not expected. According to the documentation, mbedtls_ssl_setup either returns 0 or MBEDTLS_ERR_SSL_ALLOC_FAILED if memory allocation failed. So that is your problem likely: out of memory.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Asertion error

Post by pythoncoder » Wed Aug 16, 2017 6:08 am

@droidwarrior The ESP32 port is under heavy development and it's possible that SSL/TLS is not yet fully proven. I suggest you reduce your code to a minimal code sample which produces the error and post it here. Then hopefully the assorted networking gurus will figure out whether you've uncovered a bug and, if so, report it to the developers.
Peter Hinch
Index to my micropython libraries.

droidwarrior
Posts: 4
Joined: Mon Aug 07, 2017 6:11 pm

Re: Asertion error

Post by droidwarrior » Mon Aug 21, 2017 5:03 pm

Hi,

@stijn: Already verify available memory at the moment of urequest using HTTPS and no resource exhaustion
@pythoncoder: Thanks for your answer. Im using Timer1 to poll a HTTPS urequest. Is it possible Timer1 int crash a MBEDTLS hashing or somethong in process?


Regards,

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Asertion error

Post by pythoncoder » Wed Aug 23, 2017 7:39 am

There are precautions which are necessary when writing interrupt handlers. The best way is to have the interrupt handler call your routine using schedule.

Code: Select all

from micropython import schedule
from machine import Timer
def rats(_):
	print('rats')  # This is your function
t = Timer(-1)
t.init(period=2000, mode=Timer.PERIODIC, callback=lambda _ : schedule(rats, 1))
I suggest you read this guide to writing interrupt handlers http://docs.micropython.org/en/latest/e ... rules.html.
Peter Hinch
Index to my micropython libraries.

Post Reply