Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: Release 7.0.0
    • Fix Version/s: Release 7.1.0
    • Component/s: Windows
    • Labels:
      None
    • Story Points:
      3
    • Sprint:
      2018 Sprint 04 SDK

      Description

      Application crashes when there's runtime error during TCP callback. For example, following app crashes without any error logs.

      app.js

      var win = Ti.UI.createWindow({ backgroundColor: 'white' });
       
      win.addEventListener('open', function () {
          console.log('Connecting to server');
          var socket = Ti.Network.Socket.createTCP({
              host: '127.0.0.1', port: 6262,
              connected: function (e) {
                  Ti.API.info('Connected to server at port ' + port);
                  win.backgroundColor = 'green';
              },
              error: function (e) {
                  alert(e.error);
                  Ti.API.info('Error connecting to server (' + e.errorCode + '): ' + e.error);
                  win.backgroundColor = 'red';
              },
          });
          socket.connect();
      });
       
      win.open();
      

      Expected: This Titanium app should not crash. This should alert Can't find variable: port because there's runtime error in connected callback (the variable port is not defined).

      Here's a sample server code to debug the issue. Launch this using node server.js in Node.js in order to test this.

      server.js

      var net = require('net'),
      	port = 6262;
       
      net.createServer(function (socket) {
      	console.log('client ' + socket.remoteAddress + ' connected');
       
      	socket.on('end', function () {
      		console.log('client ' + socket.remoteAddress + ' disconnected');
      	});
       
      }).listen(port, function() {
      	console.log('server listening on port ' + port);
      });
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                kiguchi Kota Iguchi
                Reporter:
                kiguchi Kota Iguchi
                Reviewer:
                Gary Mathews
              • Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-6112
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code