utkarshkukreti / select.rs

A Rust library to extract useful data from HTML documents, suitable for web scraping.
MIT License
971 stars 69 forks source link

Provide a way to recover from a potential stack overflows #68

Open let4be opened 3 years ago

let4be commented 3 years ago

I'm using select in a broad web crawler, everything is working fine until it does not... Web is full of surprises and magic input nobody expects to find that can crash almost anything(just by the sheer amount of data web contains)... sometimes, sometimes select will go into deep recursion that causes stack overflow(and I have thread stack size set to 32mb), now this might be a bug in select which can be fixed...(but I cannot even log it... because need to run crawler under gdb to catch such stuff it seems)

What I'm looking for is a way to limit the depth of recursion in select's code to ensure we do not stack overflow. Afaik stack overflows panics are impossible to recover in rust and lead to forceful program exit :\