Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9294

Running a js script from Windows can cause premature script failure

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 2.4.1
    • Shell
    • None
    • Windows 2008 r2
    • ALL
    • Hide

      run:

      mongo.exe gp test1.js

      check the counts of bases2 or fleets collections - there should be 627 documents.

      Show
      run: mongo.exe gp test1.js check the counts of bases2 or fleets collections - there should be 627 documents.

    Description

      There seems to be unexpected results when running a js script from Windows. If a script like the attached is run from the shell, not all of the records will be inserted. There will be messages in higher verbosity logs indicating that a connection was forcibly closed:

      Tue Apr 09 16:25:01.974 [conn1] insert gp.fleets ninserted:1 keyUpdates:0 locks(micros) w:13 0ms
      Tue Apr 09 16:25:01.974 [conn1] insert gp.bases2 ninserted:1 keyUpdates:0 locks(micros) w:13 0ms
      Tue Apr 09 16:25:01.989 [conn1] insert gp.fleets ninserted:1 keyUpdates:0 locks(micros) w:44 0ms
      Tue Apr 09 16:25:01.989 [conn1] Socket recv() errno:10054 An existing connection was forcibly closed by the remote host. 127.0.0.1:49334
      Tue Apr 09 16:25:01.989 [conn1] SocketException: remote: 127.0.0.1:49334 error: 9001 socket exception [1] server [127.0.0.1:49334] 
      Tue Apr 09 16:25:01.989 [conn1] end connection 127.0.0.1:49334 (0 connections now open)

      But this may not be indicative of the problem.

      Some unusual interactions are going on with the script. There will be an output for every item in the script, even if not all of them are inserted. If the print() operation is removed from the rp() function, the inserts will be completed successfully (. test2.js). If a print() command is added to the end of the script, the inserts will be completed successfully (test3.js). If a sleep() (even sleep(0)) is added to the rp() function, the inserts complete successfully (test4.js)

      The same test1.js script when run from OSX to a mongod on OSX or Windows will see the inserts complete successfully.

      Attachments

        1. test1.js
          9 kB
        2. test2.js
          9 kB
        3. test3.js
          9 kB
        4. test4.js
          9 kB

        Activity

          People

            tad Tad Marshall
            andre.defrere@mongodb.com Andre de Frere
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: