Skip to content

flaky test.parallel/test-diagnostics-channel-net #44143

Description

@kvakil

Test

test-diagnostics-channel-net

Platform

Linux x64

Console output

00:32:11 not ok 653 parallel/test-diagnostics-channel-net
00:32:11   ---
00:32:11   duration_ms: 0.269
00:32:11   severity: fail
00:32:11   exitcode: 1
00:32:11   stack: |-
00:32:11     Mismatched <anonymous> function calls. Expected exactly 1, actual 0.
00:32:11   ...

Build links

Additional information

  1. Potentially only happens in worker test suite?
  2. Could not reproduce locally with:
for i in {1..10000}; do
  ./node --abort-on-uncaught-exception \
     ./tools/run-worker.js test/parallel/test-diagnostics-channel-net.js \
     || echo "fail $i" &
done |& grep "fail "
  1. Not clear to me which callback is not getting invoked.

Activity

  1. added
    flaky-testIssues and PRs involving tests that fail intermittently in CI.
    on Aug 5, 2022
  2. kvakil commented on Aug 5, 2022

    @kvakil
    ContributorAuthor

    @theanarkh any thoughts? It's weird also that the stack trace does not include any indication what's not being called. :\

    edit: never mind, I think I found it: #44144

  3. added
    netIssues and PRs related to the net subsystem.
    on Aug 5, 2022
  4. theanarkh commented on Aug 5, 2022

    @theanarkh
    Contributor

    Thanks. I have no ideas now, i will take a look later. But i think it is not related to gc because this case will keep the channel object alive. It is different from #42170. cc @Qard.
    .

  5. theanarkh commented on Aug 5, 2022

    @theanarkh
    Contributor

    @Qard Hi, what do you think about this case. Is it the wrong way to use diagnostics_channel?

  6. Qard commented on Aug 5, 2022

    @Qard
    Member

    Already approved the fix in #44144.

  7. theanarkh commented on Aug 5, 2022

    @theanarkh
    Contributor

    But there's a lot of usage in the code, and if there's a problem, it all needs to be fixed ?
    image

  8. theanarkh commented on Aug 6, 2022

    @theanarkh
    Contributor

    Running the code as follows will trigger this error always(./node --expose-gc test/parallel/test-diagnostics-channel-net.js). The callback of onGC will be triggered before timeout.

    'use strict';
    const common = require('../common');
    const assert = require('assert');
    const net = require('net');
    const dc = require('diagnostics_channel');
    const onGC = require('../common/ongc');
    const { writeFileSync } = require('fs');
    
    const netClientSocketChannel = dc.channel('net.client.socket');
    const netServerSocketChannel = dc.channel('net.server.socket');
    
    onGC(netClientSocketChannel, { 
      ongc: () => {
        writeFileSync(1, "gc netClientSocketChannel");
      }
    });
    
    onGC(netServerSocketChannel, {
      ongc: () => {
        writeFileSync(1, "gc netServerSocketChannel");
      }
    });
    
    const isNetSocket = (socket) => socket instanceof net.Socket;
    
    netServerSocketChannel.subscribe(common.mustCall(({ socket }) => {
      assert.strictEqual(isNetSocket(socket), true);
    }));
    
    netServerSocketChannel.subscribe(common.mustCall(({ socket }) => {
      assert.strictEqual(isNetSocket(socket), true);
    }));
    gc();
    setTimeout(() => {
      console.log('timeout emit');
      const server = net.createServer(common.mustCall((socket) => {
        socket.destroy();
        server.close();
      }));
      
      server.listen(() => {
        const { port } = server.address();
        net.connect(port);
      });
    }, 10000);
    

    it is related to gc indeed. I will send a PR to fix this.Thanks !

  9. added a commit that references this issue on Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    flaky-testIssues and PRs involving tests that fail intermittently in CI.netIssues and PRs related to the net subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions