Skip to content

getProcessIdsForPort is getting false-positive results for mac, preventing start of dev server #950

@agilemarcus

Description

@agilemarcus

Prerequisites

Please answer the following questions before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version of Node and the tools
  • [ X] I checked the documentation and found no answer
  • [ X] I checked to make sure that this issue has not already been filed

Expected behavior

When I run npx office-addin-debugging start manifest.xml I would expect the dev server to startup if it is not currently running.

Current behavior

The command used in lib/port.js - getProcessIdsForPort() for mac is lsof -n -i:${port} which in my case returns a slew of closed ports:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
Google 11139 xxxx 31u IPv6 0x5cd65a15b6a9ccf3 0t0 TCP [::1]:62738->[::1]:hbci (CLOSED)
Google 11139 xxxx 39u IPv6 0x996f8a475874a8bd 0t0 TCP [::1]:62729->[::1]:hbci (CLOSED)
Google 11139 xxxx 41u IPv6 0x34619b3341fc198f 0t0 TCP [::1]:62732->[::1]:hbci (CLOSED)
Google 11139 xxxx 42u IPv6 0x9ec275c68cf98fd0 0t0 TCP [::1]:62736->[::1]:hbci (CLOSED)
Google 11139 xxxx 45u IPv6 0x8f1977c32e340d7a 0t0 TCP [::1]:62737->[::1]:hbci (CLOSED)

By modifying the command to lsof -n -i:${port} -sTCP:LISTEN it correctly returns the correct PID when the dev server is properly running, or nothing at all if the service is not running.

Steps to Reproduce

I'm not sure how to reproduce the failure as I'm not sure what introduced the CLOSED hbci listeners.

Nothing in my chrome://serviceworker-internals/ seems to be attached to that port.

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Mac Sonoma 14.6.1
  • Node version: 18+
  • Office version: Word Version 16.100.2 (25082415)
  • Tool version: 5.x but I confirmed the same CLI command is used in 6.x

Failure Logs

The found [ 11139 ] 3000 is a debug line I added to the source.

My start command is: "start": "office-addin-debugging start manifest.xml",

~/briefs % npm run start                                                            master

> office-addin-taskpane-js@0.0.1 start
> office-addin-debugging start manifest.xml

Debugging is being started...
App type: desktop
lsof -n -i:3000 -sTCP:LISTEN
found [] 3000
Starting the dev server... (webpack serve --mode development)
lsof -n -i:3000 -sTCP:LISTEN
found [] 3000
lsof -n -i:3000 -sTCP:LISTEN
found [] 3000
lsof -n -i:3000 -sTCP:LISTEN
found [ 11139 ] 3000
The dev server is running on port 3000. Process id: 11139
Sideloading the Office Add-in...
Launching word via /var/folders/pj/nlmngl1s32b52ryxsfyp2hw80000gn/T/Word add-in 95d9b863-d419-4b08-ba19-92820b857235.docx
Debugging started.

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