Skip to content

[Bug]: Regression in v28, open handle from MessageChannel()/scheduler #13144

Closed
@bradjones1

Description

@bradjones1

Version

28.1.3

Steps to reproduce

I'm not exactly sure what component of my codebase is triggering the handle, but the stacktrace (see below) and other reports seem to indicate this is from scheduler, particularly this line. I will try to isolate an MVP demonstration of code that triggers this.

Downgrading to 27.x seems to fix the problem.

The line in question from scheduler calls new MessageChannel(), and the 28.0 changelog does mention #12553, which could be related?

Expected behavior

Test suite exits with no open handles.

Actual behavior

Jest has detected the following 1 open handle potentially keeping Jest from exiting:

  ●  MESSAGEPORT

      3 | import {Appearance, AppState, LogBox, Platform, useColorScheme} from 'react-native';
      4 | import {DarkTheme, DefaultTheme, NavigationContainer, useNavigationContainerRef} from '@react-navigation/native';
    > 5 | import {createNativeStackNavigator} from '@react-navigation/native-stack';
        | ^
      6 | import * as SecureStore from 'expo-secure-store';
      7 | import Orbit from "@orbit/core";
      8 | import {DataProvider} from "react-orbitjs";

      at node_modules/scheduler/cjs/scheduler.development.js:178:17
      at Object.<anonymous> (node_modules/scheduler/cjs/scheduler.development.js:645:5)
      at Object.<anonymous> (node_modules/scheduler/index.js:6:20)
      at require (node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:23:17)
      at Object.<anonymous> (node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-dev.js:17:3)
      at Object.require (node_modules/react-native/Libraries/Renderer/shims/ReactNative.js:21:17)
      at Object.require (node_modules/react-native/Libraries/Animated/AnimatedEvent.js:16:21)
      at Object.require (node_modules/react-native/Libraries/Animated/AnimatedMock.js:13:44)
      at Object.require (node_modules/react-native/Libraries/Animated/Animated.js:19:22)
      at Object.require [as Animated] (node_modules/react-native/index.js:260:12)
      at Object.Animated (node_modules/@react-navigation/elements/lib/commonjs/PlatformPressable.tsx:21:27)
      at Object.<anonymous> (node_modules/@react-navigation/elements/lib/commonjs/Header/HeaderBackButton.tsx:14:1)
      at Object.<anonymous> (node_modules/@react-navigation/elements/lib/commonjs/index.tsx:5:1)
      at Object.<anonymous> (node_modules/@react-navigation/native-stack/lib/commonjs/views/NativeStackView.native.tsx:1:1)
      at Object.<anonymous> (node_modules/@react-navigation/native-stack/lib/commonjs/navigators/createNativeStackNavigator.tsx:19:1)
      at Object.<anonymous> (node_modules/@react-navigation/native-stack/lib/commonjs/index.tsx:4:1)
      at Object.<anonymous> (App.tsx:5:1)
      at Object.<anonymous> (__tests__/App.test.tsx:1:1)

Additional context

Similar reports at #12852 (comment), node-fetch/node-fetch#1479 (comment) and callstack/react-native-testing-library#1007 (comment)

Environment

$ npx envinfo --preset jest

  System:
    OS: Linux 5.18 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz
  Binaries:
    Node: 16.13.1 - /usr/local/bin/node
    Yarn: 1.22.15 - /usr/local/bin/yarn
    npm: 8.1.2 - /usr/local/bin/npm
  npmPackages:
    jest: ^27 => 27.5.1 

(This shows the working version of jest, otherwise this is the same environment.)

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