                 cb          : cb
         (cb) ->
             dbg("wait a little to see if #{port_file} appears, and if so read it and return port")
-            t = misc.walltime()
             f = (cb) ->
-                if misc.walltime() - t > 5  # give up
-                    cb(); return
                 fs.exists port_file, (exists) ->
                     if not exists
                         cb(true)

        return
    t = new Date() - _restarted_sage_server
    if t <= SAGE_SERVER_MAX_STARTUP_TIME_S*1000
        f = () ->
            err = "restarted sage server #{t}ms ago -- still waiting for it to start"
            dbg(err)
            cb(err)
        setTimeout(cb, 3000)
        return

    _restarting_sage_server = true

                                catch error
                                    cb('reading port corrupt')
            misc.retry_until_success
                f        : f
                max_time : 7000
                cb       : cb
    ], (err) =>
        _restarting_console_server = false
        _restarted_console_server = new Date()
        dbg("finished trying to restart console_server")
        if err
            dbg("ERROR: #{err}")
        cb(err, port)
    )

