Recalbox API not starting - RecalboxOS 4.0.1
-
Recalbox API not starting - RecalboxOS 4.0.1
Much like this problem
https://github.com/recalbox/recalbox-os/issues/1009The PM2 process just hangs. Although this fix appears to be present in my 4.0.1 build.
https://github.com/recalbox/recalbox-buildroot/pull/432
The log for PM2 indicates an error;
2017-04-24 16:35:33: [PM2][WORKER] Started with refreshing interval: 30000
2017-04-24 16:35:33: [[[[ PM2/God daemon launched ]]]]
2017-04-24 16:35:33: BUS system [READY] on port /var/.pm2/pub.sock
2017-04-24 16:35:33: RPC interface [READY] on port /var/.pm2/rpc.sock
2017-04-24 16:35:33: Starting execution sequence in -cluster mode- for app name:api id:0
2017-04-24 16:35:34: App name:api id:0 online
2017-04-24 16:35:34: [PM2] Error caught by domain:
TypeError: obj.hasOwnProperty is not a function
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:49:13)
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:53:22)
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:53:22)
at cloneWrap (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:65:10)
at Object.clone (/usr/recalbox-api/node_modules/pm2/lib/Utility.js:42:12)
at Object.Common.deepCopy.Common.serialize.Common.clone (/usr/recalbox-api/node_modules/pm2/lib/Common.js:218:18)
at /usr/recalbox-api/node_modules/pm2/lib/God.js:372:25
at Worker.cluOnline (/usr/recalbox-api/node_modules/pm2/lib/God.js:186:17)
at Worker.g (events.js:291:16)
at emitNone (events.js:86:13)
2017-04-24 16:35:34: [PM2] Trying to update PM2...
2017-04-24 16:35:34: App name:api id:0 disconnected
2017-04-24 16:35:34: App [api] with id [0] and pid [1294], exited with code [0] via signal [SIGINT]
2017-04-24 16:35:34: Starting execution sequence in -cluster mode- for app name:api id:0
2017-04-24 16:35:35: App name:api id:0 online
2017-04-24 16:35:35: App name:api id:0 disconnected
2017-04-24 16:35:35: App [api] with id [0] and pid [1314], exited with code [0] via signal [SIGINT]
2017-04-24 16:35:35: Starting execution sequence in -cluster mode- for app name:api id:0
Be sure to have the latest version by doingnpm install pm2@latest -g
before doing this procedure.
/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:49
if (obj.hasOwnProperty(attr)) {
^TypeError: obj.hasOwnProperty is not a function
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:49:13)
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:53:22)
at safeDeepClone (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:53:22)
at cloneWrap (/usr/recalbox-api/node_modules/pm2/lib/tools/safeclonedeep.js:65:10)
at Object.clone (/usr/recalbox-api/node_modules/pm2/lib/Utility.js:42:12)
at Object.Common.deepCopy.Common.serialize.Common.clone (/usr/recalbox-api/node_modules/pm2/lib/Common.js:218:18)
at Object.getFormatedProcesses (/usr/recalbox-api/node_modules/pm2/lib/God/Methods.js:68:21)
at getMonitorData (/usr/recalbox-api/node_modules/pm2/lib/God/ActionMethods.js:42:25)
at Server.onmessage (/usr/recalbox-api/node_modules/pm2-axon-rpc/lib/server.js:105:6)
at emitTwo (events.js:106:13) -
Recalbox 4.0.1 ? are you sure ? Not recalbox 4.1 ?
-
@substring Sorry, I can't read, or type or both.
It's 4.1.0 -
@thehive cuz we switched to nodejs 6.9.1 on 4.1, and the API just won't work anymore with it.
-
I built this myself from source as I've added some tweaks to get Daphne working.
Would updating PM2 to the latest version resolve this?
-
@thehive /me knows definitely nothing to nodejs, npm, PM2 and such stuff ... And to tell you the truth, I'd rather get rid of PM2 and start the api with the nodejs bin (that's how recalbox-manager2 works, see /etc/init.d/S94manager)
I guess you do need the API ?
Concerning Daphne, have you made a package ? the recalbox-configgen part ? are you willing to contribute to the project ?
-
Anyway, some commands of the API are broken, so don't have regrets.
For example, if you planned to launch games through the API, forget it: if I remember well, ES is not re-launched when exiting a game. -
@Substring I've modified 2 or three configgen scripts, yes. It's quite a hack at the moment as there's no way of providing the many parameters that you can supply to Daphne - I just pass a set that suit me - so some hard coding sadly.
I would certainly be willing to help get this implemented properly, yes.Regarding the API, this is for something else I was working on. I was hoping I could get it working in 4.1 and you might know of a quick(ish) fix, but if not I suppose I could drop back to 4.0.1.
-
@thehive I pinged the api dev, no answer today, I'll try again tomorrow.
Regarding Daphne, i never tried to compile it. I see it uses SDL1, which saddens me quite much, but ok
Regarding configgen : most part of it is to setup controllers, eventually tweak some config file, but that's all. It's a real pain when config files are not documented, as it's some try'n'die progression to find out.
But I'd be glad to give you a hand for a "proper" integration, Buildroot is quite of a monster, we don't get that many contributors
-
@Substring I will gather together what the information regarding what I've changed and we can discuss. I didn't take notes as I went along so I'll need to work backwards. I don't actually think I changed too much though.
As an aside, I took a look at S94manager and I see that it also uses the API in some instances (for example launching a ROM), so some of those things are also broken in 4.1.
I've being playing around with the API node module and it runs on 4.1 directly as a node process with just a few minor fixes to to the solfegejs node module.
I am going to patch S95api to start this process without PM2. If you'd like me to share the changes I'm happy to do so. -
@thehive I'd be very glad to review your PR
@thehive said in Recalbox API not starting - RecalboxOS 4.0.1:
As an aside, I took a look at S94manager and I see that it also uses the API in some instances (for example launching a ROM), so some of those things are also broken in 4.1
I'm not sure to understand what you mean ... The new manager (v2) can't launch roms, that feature has been disable as far as I remember (@DjLeChuck can you confirm ?). Because launching roms is a little more complex than that (need to launch them with configgen, make sure ES is not running as so far i haven't been able to externally put ES to hibernate while the emulator is running)
-
I'm not sure to understand what you mean ... The new manager (v2) can't launch roms, that feature has been disable as far as I remember (@DjLeChuck can you confirm ?).
No, it's definitely not disabled, it's just broken, because the API is broken.
Now I've got the API working in 4.1 it will launch ROMS from within the V2 manager, but as @kjbstar pointed out, it fails to relaunch ES after the ROM is quit. I'm going to have a stab at fixing the way that the API handles ROM launching, because, as you point out, at the moment it's not performed by configgen. -
@thehive said in Recalbox API not starting - RecalboxOS 4.0.1:
I'm going to have a stab at fixing the way that the API handles ROM launching, because, as you point out, at the moment it's not performed by configgen.
Hmm, yes it is : https://github.com/recalbox/recalbox-api/blob/3aee79e43f60b59912a43b186f2d05afdad93085/config/config.js#L11
(or it's something else ?)The complex stuff is about ES. Did not found neither how to handle it properly.
-
@kjbstar to be honnest, the real deal is to make ES launch the rom for sooooo many reasons. The main one being that es knows how to launch properly configgen. I would dream of a dbus interface to tell es to launch a game, but that's sime complicated duty for my very lacking skills in C++.
The other trick i tried was linux signal handles to tell es to "hibernate" the same way it does when starting an emulator. Despite the "sleep" signal was working great, the wakeup was very painful, as es lost quite some textures. It would even crash after several launches.
Someone contacted me telle ng me he succeeded in adding a socket server in es to launch roms and it worked very good. He doesn't want to push his.commits because his code looks more like a proof of concept, but I do hope he'll contribute "soon"
-
@Substring said in Recalbox API not starting - RecalboxOS 4.0.1:
@kjbstar to be honnest, the real deal is to make ES launch the rom for sooooo many reasons. The main one being that es knows how to launch properly configgen. I would dream of a dbus interface to tell es to launch a game, but that's sime complicated duty for my very lacking skills in C++.
Yes that would be nice (and so logical finally).
The other trick i tried was linux signal handles to tell es to "hibernate" the same way it does when starting an emulator. Despite the "sleep" signal was working great, the wakeup was very painful, as es lost quite some textures. It would even crash after several launches.
Nice trick, I can imagine the disappointement during your tests...
On my side I ended up to brutally kill it, then re-launch it (and not even with S31emulationstation... I had a weird bug - reminder: my project is external and in php ahah).Someone contacted me telle ng me he succeeded in adding a socket server in es to launch roms and it worked very good. He doesn't want to push his.commits because his code looks more like a proof of concept, but I do hope he'll contribute "soon"
That would be great yes. Can't wait to test this
-
A few tries : using
kill -STOP <pid>
andkill -CONT <pid>
does stop/resume ES. But it still gets inputs from joypads. But that's something i should be able to manage by patching ES. But using this method has drawbacks : the image is still displayed (so i guess it will conflict with emulators ... Maybe we can get around withchvt
oropenvt
). I hope to have good news soonEdit: grrrrr .... SDL on pi doesn't use framebuffer, but GLES straight away; so playing with ttyX has no meaning ... I'm so disappointed ... But I still have ideas to try to make ES launch a rom (but i must admit it's more of some tricks than some pro programming)
-
Big thanks to @sevenx who gave me his code to add a socket server to ES and launch games through it. Looks like it runs rather fine after a few hours spent on it to improve and fix bugs. Once finished, i hope to have it accepted by his holyness DigitalLumberjack so that everyone can enjoy it.
Now I'm dead tired, need some sleep
-
Glory to @sevenx and @Substring \o/
4.1 will be awesome