(评论)
(comments)

原始链接: https://news.ycombinator.com/item?id=43893581

一个Hacker News帖子讨论了Chromium中发现的一个与JavaScript的FinalizationRegistry API相关的bug。由于依赖垃圾回收,该API被认为比较棘手且可能不可靠。bug修复涉及确保标志`is_finalization_registry_cleanup_task_posted_`被正确重置,以防止跳过清理任务。用户表达了对依赖垃圾回收执行关键任务的担忧,并建议使用替代的内存管理方法,例如带有明确大小限制的池或arena。 一位用户分享了其提交与窗口打开行为更改相关的Chromium bug的经验,强调了Chromium团队的bug识别和修复流程的积极体验。讨论还涉及自动化更广泛的社会影响以及潜在的失业问题,尤其是在建筑行业,原发帖人公司为砌砖行业制造机器人。一些人认为自动化可以提高危险工作的安全性,而另一些人则担心失业率上升。

相关文章
  • (评论) 2024-08-27
  • Chromium Bug 赏金金钱树浏览器 2024-01-07
  • (评论) 2024-07-14
  • (评论) 2024-03-17
  • (评论) 2025-03-08

  • 原文
    Hacker News new | past | comments | ask | show | jobs | submit login
    Finding a Bug in Chromium (bou.ke)
    60 points by bouk 23 hours ago | hide | past | favorite | 12 comments










    >FinalizationRegistry

    >Avoid where possible

    >Correct use of FinalizationRegistry takes careful thought, and it's best avoided if possible. It's also important to avoid relying on any specific behaviors not guaranteed by the specification. When, how, and whether garbage collection occurs is down to the implementation of any given JavaScript engine. Any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. Garbage collection is a hard problem that JavaScript engine implementers are constantly refining and improving their solutions to.

    Kinda tricky API



    > A conforming JavaScript implementation, even one that does garbage collection, is not required to call cleanup callbacks.

    Really looking forward to the "Explicit Resource Management" proposal[0] that sounds like a much better idea really.

    [0]: https://github.com/tc39/proposal-explicit-resource-managemen...



    Hey! I too just filed my first Chromium bug[1]! They changed a behavior that broke opening new windows with tabs, and thus broke my advanced tab search extension Tabasco[2].

    I was frankly impressed by the experience. They had me create a minimal extension illustrating the issue and were very quickly able automate a bisection that found its root, a security fix somewhat bluntly resolved. They've supposedly fixed the issue in an upcoming release I await with bated breath.

    - [1] https://issues.chromium.org/issues/405283740

    - [2] https://chromewebstore.google.com/detail/tabasco-advanced-ta...



    Hm.. I would honestly try to avoid relying on finalization mechanism of a garbage collector like this. It sounds brittle from the start. Even without the bug, I can imagine you can get into a situation where some unused JS object holds a reference to a giant thing in wasm memory, but engine doesn't run the GC, because it technically doesn't know that, it only sees the little pointer object which seems small.

    I think WASM had historically had some problem with freeing memory, so I'd probably rather rely on some pooling or arena with explicit memory size limit (for the whole allocated wasm memory).



    My first guess would be that this early return is always happening after entering the bugged state. The one cleanup task could get stuck or not cleanup after itself properly.

        // Only one cleanup task is posted at a time.
        if (!HasDirtyJSFinalizationRegistries() || is_finalization_registry_cleanup_task_posted_) {
          return;
        }
    
    https://source.chromium.org/chromium/chromium/src/+/main:v8/...


    Ah this makes a lot of sense, perhaps the posted flag doesn't get reset e.g. if this branch gets followed: https://source.chromium.org/chromium/chromium/src/+/main:v8/...


    Yeah this is the bug. My bad, will fix.


    Great technical post, however:

    > At Monumental we’ve building robots to automate construction, starting with masonry.

    If you thought running to construction jobs was safe, well thanks to Monumental, it soon won't be.

    The end goal is to achieve a 10% increase of global unemployment by the latest 2035 and 40% of employers anticipate reducing their workforce where AI can automate tasks by the 2030 deadline according to the WEF 2025 Future of Jobs report. [0]

    Worse if earlier.

    [0] https://www.weforum.org/publications/the-future-of-jobs-repo...



    And according to OSHA, construction jobs account for more fatal injuries than any other job, so in a sense they're saving lives by reducing the number of dangerous jobs.

    We've already managed to handle the desire to keep the sham of "jobs are a necessary part of life for everyone who isn't ultra-wealthy" going via Bullshit Jobs, we can keep inventing more Bullshit Jobs.

    Heck, we probably both work Bullshit Jobs. Do we really need 20 different companies, all with thousands of employees, optimizing ad-impressions to make teenagers want to drink coke and buy nike shoes?

    Do we really need 10 different "uber for pet-sitting your turtle" apps?

    Each failed startup was, in reality, a large bag of bullshit jobs that transferred money from the VCs to bullshit-job workers, who's to say those people couldn't be ex construction workers?



    Given the author's name, he's Dutch which does use a lot of brick in their houses... for decoration, it's concrete blocks with prefab brick facades for at least two decades now, built by robots. See for example https://www.bouwtotaal.nl/2021/10/prefab-gevelelementen-voor...

    The demand for housing and thus construction workers isn't going down any time soon; the Netherlands alone needs to build a million homes in the next decade and are running behind on that. Brick walls is just one task of many in a construction project, just like your JIRA or Github ticket is just one task of many in a software project.



    Prefab stone strips are used here and there but most brick facades are still built by hand on-site.

    There's a huge shortage of workers, which is why we're working on this.



    Cooking and serving at tables also won't be an excape route, given that there are already kitchen and waitresses robots.

    We are really going into a dystopian world, unless there is some event that disrupts the roadmap to drive everyone into unemployment, besides a few elite folks that get to profit from the robots.

    The generations to come will have much more to worry about than climate, also note how all the ongoing wars, geopolitcs change back to cold war days, and AI race has made everyone forget about the planet.

    Forcing us to use paper straws and wood cuttlery won't save us.







    Consider applying for YC's Summer 2025 batch! Applications are open till May 13


    Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact



    Search:
    联系我们 contact @ memedata.com