Open Frikitrok opened 5 years ago
@Frikitrok -- sorry to learn you're having issues. You're welcome to put up a PR which handles the centos case. I don't have time to take a deep dive immediately, but let me know how I can assist.
I wonder if there is a timeout 🤔 happening before dynamodb emulator starts.
what timeout? i can add that after i removed port binding validation, everything works well still not sure is there a problem with port-pid module, or maybe permission issue
Ah I was thinking about the dynamodb output but that would show up in the logs hrrm. I will review port-pid and see if I can provide insight. Some of that may indeed be specific to the distro.
Seems likely that the format on your machine is different than the expected format coming from lsof
which I believe is invoked directly here https://github.com/radiovisual/port-pid/blob/master/index.js (directly here https://github.com/radiovisual/netstats/blob/master/index.js#L12 in sub dep). We can potentially use another module here that is more resilient to different distros/os ?
Wow, that where the problem, on my cenots os and centos 7 docker container were no 'lsof' package at all. Installed it and everything went to normal.
I tried to use find-process and pid-from-port npm packages but looks like they use one of these 'netstat' 'lsof' 'fuser' staff. So i think there no common way for all distro to make this work.
I think for now you could add to prerequisites to install 'lsof' package to readme. and add correct debug if return is empty, smthing like 'can not verify port, install lsof and try again'
Or remove this validation, shouldn't nodejs throw error if something already bind on port?
instead of using validation, maybe better to add catch on java spawn?
proc.on('error', (err) => {
console.log('Failed to start simulator.');
throw new Error(${givenOptions.port} is bound and unavailable
);
});
I will take a look to see if there is something I can do quickly here but your best bet (i.e. fastest) is to contribute a fix that works on your machine. happy to continue to support here.
Added more debug and what i can see that for some reason portOnPID const is empty. I tried another modules but still get this empty PID list which brake validation of port binding. Not sure where this comes from, maybe because of my centos distribution
Emulator has started but need to verify socket 62224 { all: [], tcp: [], udp: [] }