-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Issue type
Bug
How did you install PythonMonkey?
None
OS platform and distribution
Ubuntu 22.04
Python version (python --version
)
Python 3.10.12
PythonMonkey version (pip show pythonmonkey
)
main branch
Bug Description
Title
seg fault after 60 seconds on when attempting to load the browser socketio bundle into pythonmonkey!
Repro
Client Side (the place where the seg fault shows up)
client side socketio pmjs pythonmonkey code
pmjs
PythonMonkey JavaScript code for the client:
client-socketio-pmjs.js
#!/usr/bin/env pmjs
const io = require('./socket.io.min.js');
const socket = io('http://localhost:3490');
console.log(socket.on);
console.log(socket.emit);
socket.onAny((eventName, ...args) => {
console.log(eventName);
console.log(args);
});
socket.on('connect', () => {
console.log('Connected to the server');
socket.emit('clientMessage', 'hello from JS client');
});
socket.on('serverMessage', (msg) => {
console.log('Message from server:', msg);
socket.disconnect();
});
socket.on('disconnect', () => {
console.log('Disconnected from the server');
});
socket.io.min.js
downloaded from --> https://cdn.socket.io/4.7.4/socket.io.min.js
- just use the file I send in my slack message, not sure if this is the same one.... probably is, but use the file I sent in my slack message to make sure you're 100% using the same one as me...
how to run the client
pmjs client-socketio-pmjs.js
The NodeJS SocketIO server I happen to have talking to this client
code for the nodejs socketio server
node
NodeJS JavaScript code for the server
server-socketio-nodejs.js
#!/usr/bin/env node
const http = require('http');
const server = http.createServer();
const io = require('socket.io')(server, {
cors: {
origin: "*"
}
});
io.on('connection', (socket) => {
console.log('A client connected');
socket.on('clientMessage', (msg) => {
console.log('Message from client:', msg);
socket.emit('serverMessage', 'OK I GOT IT');
});
socket.on('disconnect', () => {
console.log('A client disconnected');
});
});
server.listen(3490, () => {
console.log('Server listening on port 3490');
});
package.json
{
"dependencies": {
"socket.io": "^4.7.4",
"socket.io-client": "^4.7.4",
"socketio": "^1.0.0"
}
}
instructions to run nodejs socketio server:
npm i
node server-socketio-nodejs.js
Refer to this slack message on the private Distributive slack which only Distributive developers have access to: https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1706703736711539
Standalone code to reproduce the issue
Put my code above,
Relevant log output or backtrace
(pythonmonkey-py3.10) will@bestia:~/test/challenge-dcp-client-pm ➡ time ./client_socketio.js
[Function]
[Function: value]
Segmentation fault (core dumped)
real 1m1.459s
user 0m0.207s
sys 0m0.065s
Additional info if applicable
No response
What branch of PythonMonkey were you developing on? (If applicable)
main
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working