micropython / micropython/micropython

Crash micropython in pairheap.h

Open
#7,289 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
22.1k
Forks
9k
Avg merge
6d 4h
Merged PRs (30d)
16

Description

Hello Team,

Can you help us to identify why this crash appears or what we can do to avoid it? (ESP32 micropython port)

assertion "node->child == NULL && node->next == NULL" failed: file "../../py/pairheap.h", line 88, function: mp_pairheap_push
abort() was called at PC 0x40178577 on core 0

ELF file SHA256: 0000000000000000

Backtrace: 0x40095138:0x3ffce620 0x4009556d:0x3ffce640 0x40178577:0x3ffce660 0x400ef1c2:0x3ffce690 0x400e4136:0x3ffce6b0 0x400dfe71:0x3ffce6e0 0x400dffad:0x3ffce700 0x400ee07f:0x3ffce720 0x400e41f8:0x3ffce7c0 0x400dfe71:0x3ffce7f0 0x400edff9:0x3ffce810 0x400e41f8:0x3ffce8b0 0x400dfe71:0x3ffce920 0x400dffad:0x3ffce940 0x400ee07f:0x3ffce960 0x400e41f8:0x3ffcea00 0x400dfe71:0x3ffcea70 0x400dfe9a:0x3ffcea90 0x400dff0b:0x3ffceab0 0x400eb251:0x3ffceb40 0x400eb597:0x3ffceb70 0x400e0032:0x3ffcec50 0x400ee339:0x3ffcec90 0x400e41f8:0x3ffced30 0x400dfe71:0x3ffced90 0x400dfe9a:0x3ffcedb0 0x40107d1a:0x3ffcedd0 0x40107ede:0x3ffcee60 0x400f79bd:0x3ffceeb0 0x40095b61:0x3ffceee0

looking into the pairheap.h:

// Push new node onto existing heap.  Returns the new heap.
static inline mp_pairheap_t *mp_pairheap_push(mp_pairheap_lt_t lt, mp_pairheap_t *heap, mp_pairheap_t *node) {    
                 assert(node->child == NULL && node->next == NULL);    
                 return mp_pairheap_meld(lt, node, heap); // node is first to be stable
}

What means "push a new node"? This is related with uasyncio? (We are using uasyncio)

Thanks for help us.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with py/pairheap.h, especially the assertion at line 88 in mp_pairheap_push, and review how the ESP32 MicroPython port uses it with uasyncio. Use the supplied backtrace and a reproducible workload to identify why a pushed node already has child or next links. Done means documenting the cause and a supported way to avoid the crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, python
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.