The program stalls during the debugging session while waiting for a promise to be resolved

  node.js, pipe, python
test("scanFolder", async () => {
  const SMBHandler = require('./SMB3Handler')
  const Schema = require("./test_dependencies/command_pb")
  const SMB3PythonAdapter = require('./SMB3PythonAdapter')
  const fs = require('fs')

  const smb3handler = new SMBHandler()
  await expect(smb3handler.connect('ZDHQ-HUB', 'reality', 'reality')).resolves.not.toThrow()

  const entries = []
  await smb3handler.scanFolder(String.raw`ZDHQ-HUBUsersRealityDesktopzd-smb3`, entries)
  expect(entries).toBeInstanceOf(Array)
}, 1000000)
  async scanFolder(path, entries) {
    const subEntries = await this.getFolderContent(path);
    const promises = [];

    for (const entry of subEntries) {
      if (entry.type === 'Directory') {
        const promise = this.scanFolder(`${path}${entry.filename}`, entries);
        promises.push(promise);
        continue;
      }

      entries.push(entry);
    }
    await Promise.all(promises);
  }

I want to consume an SMB3 client written in Python3. Everything is great so far. My case is peculiar. If I run the test, it will pass but whenever I want to debug the application putting a breakpoint at await Promise.all(promises);, and press resume program in the debugger 8 or 10 times, it will never resolve after these successive resume program clicks. In fact, during the runtime, it handles those of ones without any issues. It is as if the Python process does not return anything if all of this persists too much. But I’m not sure about my theorem and do not know how to prevent it.

Source: Python Questions

LEAVE A COMMENT