惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Help Net Security
罗磊的独立博客
博客园 - Franky
小众软件
小众软件
博客园 - 三生石上(FineUI控件)
博客园 - 叶小钗
爱范儿
爱范儿
月光博客
月光博客
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
GbyAI
GbyAI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
大猫的无限游戏
大猫的无限游戏
Y
Y Combinator Blog
Martin Fowler
Martin Fowler
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
T
Threat Research - Cisco Blogs
Spread Privacy
Spread Privacy
Hacker News: Ask HN
Hacker News: Ask HN
B
Blog RSS Feed
Know Your Adversary
Know Your Adversary
T
Troy Hunt's Blog
I
InfoQ
L
Lohrmann on Cybersecurity
Recent Announcements
Recent Announcements
H
Hacker News: Front Page
Scott Helme
Scott Helme
Jina AI
Jina AI
云风的 BLOG
云风的 BLOG
Engineering at Meta
Engineering at Meta
The Register - Security
The Register - Security
C
CERT Recently Published Vulnerability Notes
MongoDB | Blog
MongoDB | Blog
Help Net Security
Help Net Security
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
J
Java Code Geeks
AWS News Blog
AWS News Blog
阮一峰的网络日志
阮一峰的网络日志
T
Threatpost
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog
Cloudbric
Cloudbric

ashishb.net

A day in Luxembourg - the richest country in the world I was asked to install malware during a fake interview Book summary: Breakneck - China's quest to engineer the future by Dan Wang Book summary: How to Teach Your Baby to Read Book Summary: The Discontented Little Baby Book by Pamela Douglas Introducing Amazing Sandbox - run third-party tools and AI agents securely on your machine Why software outsourcing gets a bad reputation? Book summary: The Natural Baby Sleep Solution by Polly Moore A day in Antwerp, Belgium Journey of online influencers Two days in Brussels, Belgium Shortcuts - when we love them and when we don't A visit to Rakhigarhi Three days in overhyped Paris Empty Japan, crowded Tokyo The real lock-in in GitHub is not the code, but the stars 11-day Norwegian Breakaway East Caribbean cruise Sanskrit and Sri Lankan Air Force Use REST with Open API The Achilles heel of American capitalism Costa Rica in 4 days At a juice stall in Sri Lanka A short stay at Warsaw, Poland Best practices for using Python & uv inside Docker Two days in Vilnius, Lithuania How IntelliJ IDEs waste disk space Pregnancy Why there aren't many digital nomads from India Two days in Riga, Latvia To keep your machine secure, run third-party tools inside Docker Family Ties in Your DNA: Some relatives are closer than others Doctors per capita Two days in Tallinn, Estonia Ship tools as standalone static binaries Made in America Two days in Helsinki, Finland Maintaining an Android app is a lot of work The land of good deals Two days in Oslo, Norway FastAPI vs Flask performance comparison Google Search is losing to Perplexity Two days in Dublin, Ireland Continuous integration ≠ Continuous delivery World's simplest project success heuristic London in 5 days It is hard to recommend Python in production Inflation, IRS, Credit cards, and Vendors Temu and the Chinese approach Things to do in Miami Florida Revenue vs Cost Axis Language learning as an adult The unanchored babies of the green card limbo Price variance in the United States A day in Louisville, Kentucky A surprisingly positive experience with Air India Unhospitable Airports Android: Don't use stale views USA = Union of Sales and Advertisement A day in Nashville, Tennessee Minimize Javascript in your codebase A day in Birmingham, Alabama In defense of ad-supported products Real vs artificial world The science behind Punjabi singers Hiking Mt. Fuji The Indian startup bubble is insane Repairing database on the fly for millions of users Book Summary: One up on Wall Street by Peter Lynch It is hard to recommend Google Cloud At the Prague airport Kyoto in three days Migrating from WordPress to Hugo Book summary: Sick Societies by Robert B. Edgerton Statistical outcomes require statistical games Illegal immigrants to Europe via Cairo Tokyo in three days Mobs are Status Games Writing Script matters as much as the spoken language Sri Lanka in 5 days LLMs: great for business but bad business Book Summary: Safe Haven by Mark Spitznagel Mac shortcut for typing Avagraha symbol On a bus with an asylum seeker Nicaragua in 5 days When to commit Generated code to version control Why I always buy a local SIM in a foreign country Use Makefile for Android Four days in Guadalajara, Mexico Android Navigation: Up vs Back Hotels vs Airbnb vs Hostels Currency issues in Argentina Abstractions should be deep not wide Some data on podcasting Always support compressed response in an API service A day in El Calafate - Patagonia, Argentina Hermetic docker images with Hugging Face machine learning models American Elections The sound of "ch" API services should always have usage Limits Hiking in El Chaltén - trekking capital of Argentina
Android uncaught exception handler and ANR
Ashish Bhatia · 2022-09-11 · via ashishb.net

While trying to install a custom exception handler to catch uncaught exceptions (crashes), I ended up writing

1
2
CustomExceptionHandler handler = new CustomExceptionHandler(Thread.currentThread().getUncaughtExceptionHandler());
Thread.setDefaultUncaughtExceptionHandler(handler);

instead of

1
2
3
Thread.UncaughtExceptionHandler existingHandler = Thread.getDefaultUncaughtExceptionHandler();
CustomExceptionHandler handler = new CustomExceptionHandler(existingHandler);
Thread.setDefaultUncaughtExceptionHandler(handler);

The difference looks minor but it broke the exception handler and converted every crash into a cryptic ANR!

1
2
3
4
5
6
7
0 libc.so syscall
1 libart.so art::ConditionVariable::WaitHoldingLocks(art::Thread*)
2 libart.so art::ThreadList::WaitForOtherNonDaemonThreadsToExit(bool)
3 libart.so art::JII::DestroyJavaVM(_JavaVM*)
4 libandroid_runtime.so android::AndroidRuntime::start(char const*, android::Vector const&, bool)
5 app_process64 main
6 libc.so __libc_init

Very occasionally, I got a more useful error that didn’t look related but it was.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
java.lang.StackOverflowError:
      at net.ashishb.androidmusicplayer.util.CustomExceptionHandler.uncaughtException (CustomExceptionHandler.java:20)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1068)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1063)
      at net.ashishb.androidmusicplayer.util.CustomExceptionHandler.uncaughtException (CustomExceptionHandler.java:22)
      at org.chromium.base.JavaExceptionReporter.uncaughtException (chromium-Monochrome.aab-stable-484407323:6)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1068)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1063)
      at net.ashishb.androidmusicplayer.util.CustomExceptionHandler.uncaughtException (CustomExceptionHandler.java:22)
      at org.chromium.base.JavaExceptionReporter.uncaughtException (chromium-Monochrome.aab-stable-484407323:6)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1068)
      at java.lang.ThreadGroup.uncaughtException (ThreadGroup.java:1063)
      at net.ashishb.androidmusicplayer.util.CustomExceptionHandler.uncaughtException (CustomExceptionHandler.java:22)
      at org.chromium.base.JavaExceptionReporter.uncaughtException (chromium-Monochrome.aab-stable-484407323:6)