jbmusso / gremlin-javascript

JavaScript tools for graph processing in Node.js and the browser inspired by the Apache TinkerPop API
MIT License
214 stars 63 forks source link

Error: WebSocket closed #80

Open abdullahshahin opened 7 years ago

abdullahshahin commented 7 years ago

am using CosmosDB from azure, I want to insert 65K vertices and edges statements in a loop, I used async limit set to 50 as follows

return new Promise((resolve,reject)=>{
        async.eachLimit(queries,numberOfQueriesPerTransaction,(query,callback)=>{
            executor(query).then(()=>{
                console.log('Inserted node successfully :  ', query);
                callback();
            }).catch((err)=>{
                console.log('Failed to execute node query: ', query, err);
                callback();
            });
        },(err)=>{
            resolve();
        });
    });

it does the work just fine, but after few hundreds of successful insertions the following error shows

Failed to execute node query:  g.V('miayers').addE('reporting_to').to(g.V('estiles')) { Error: WebSocket closed
    at GremlinClient.cancelPendingCommands (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/gremlin-secure/lib/GremlinClient.js:250:19)
    at GremlinClient.handleDisconnection (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/gremlin-secure/lib/GremlinClient.js:216:12)
    at WebSocketGremlinConnection.<anonymous> (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/gremlin-secure/lib/GremlinClient.js:131:23)
    at emitOne (events.js:96:13)
    at WebSocketGremlinConnection.emit (events.js:188:7)
    at WebSocketGremlinConnection.onClose (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/gremlin-secure/lib/WebSocketGremlinConnection.js:81:12)
    at WebSocketGremlinConnection._this.ws.onclose (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/gremlin-secure/lib/WebSocketGremlinConnection.js:55:20)
    at WebSocket.onClose (/Users/abshahin/dev/ankaboot-employee-entity-lambda/node_modules/ws/lib/EventTarget.js:107:16)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:191:7)
  details: 
   CloseEvent {
     target: 
      WebSocket {
        domain: null,
        _events: [Object],
        _eventsCount: 1,
        _maxListeners: undefined,
        readyState: 3,
        bytesReceived: 740,
        extensions: null,
        protocol: '',
        _binaryType: 'arraybuffer',
        _finalize: [Function: bound finalize],
        _finalizeCalled: true,
        _closeMessage: null,
        _closeTimer: null,
        _closeCode: 1006,
        _receiver: null,
        _sender: null,
        _socket: null,
        _ultron: null,
        protocolVersion: 13,
        _isServer: false,
        url: 'wss://ankaboot-test.graphs.azure.com:443',
        _req: null },
     type: 'close',
     wasClean: false,
     reason: '',
     code: 1006 } }

after few failures, the process get back to insert other statements successfully.