Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Running atom from the command line can un-set process.env.NODE_DEV, causing performance degradation & JS crashes #12024

Closed

Description

@ggreer

Unless Atom is running in dev mode, it sets process.env.NODE_ENV to "production". (The relevant code is here:

process.env.NODE_ENV ?= 'production' unless devMode
) This improves the speed of React by disabling its debug mode.

But if Atom is already running, and already has file.txt open, and one runs atom file.txt from the command line, the command line's environment is used to overwrite Atom's current process.env. Most people don't have NODE_DEV set in their environment, so React falls back to its slow debug mode.

The code responsible for "cloning" the environment is

delete to[key]
Notice that it deletes the existing environment.

If React starts in production mode, it won't create some key debugging data structures. If it later changes to dev mode (because process.env.NODE_DEV becomes undefined), it will try to access those structures and crash.

This bug is responsible for several reported issues in packages that I maintain: Floobits/atom-term3#63
Floobits/floobits-atom#121

Activity

  1. winstliu commented on Jun 22, 2016

    @winstliu
    Contributor
  2. ggreer commented on Jun 22, 2016

    @ggreer
    ContributorAuthor

    Just FYI, I'll probably make a PR for this today.

  3. added 2 commits that reference this issue on Jun 22, 2016
    49ee71e
    76e59a2
  4. lock commented on Apr 6, 2018

    @lock

    This issue has been automatically locked since there has not been any recent activity after it was closed. If you can still reproduce this issue in Safe Mode then please open a new issue and fill out the entire issue template to ensure that we have enough information to address your issue. Thanks!

  5. locked and limited conversation to collaborators on Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions