Added support for blaming infinite loops.

This commit is contained in:
Nick Winter 2014-05-25 12:15:32 -07:00
parent a8cffacaf3
commit 3dd362c01e
9 changed files with 22 additions and 20 deletions

View file

@ -8,8 +8,8 @@ CocoClass = require 'lib/CocoClass'
module.exports = class Angel extends CocoClass
@nicks: ['Archer', 'Lana', 'Cyril', 'Pam', 'Cheryl', 'Woodhouse', 'Ray', 'Krieger']
infiniteLoopIntervalDuration: 5000 # check this often
infiniteLoopTimeoutDuration: 2500 # wait this long for a response when checking
infiniteLoopIntervalDuration: 7500 # check this often
infiniteLoopTimeoutDuration: 5000 # wait this long for a response when checking
abortTimeoutDuration: 500 # give in-process or dying workers this long to give up
constructor: (@shared) ->

View file

@ -395,6 +395,7 @@ module.exports = class Simulator extends CocoClass
jshint_W030: {level: "ignore"} # aether_NoEffect instead
aether_MissingThis: {level: 'error'}
#functionParameters: # TODOOOOO
executionLimit: 1 * 1000 * 1000
if methodName is 'hear'
aetherOptions.functionParameters = ['speaker', 'message', 'data']
#console.log "creating aether with options", aetherOptions

View file

@ -119,7 +119,7 @@ module.exports = class CocoView extends Backbone.View
renderScrollbar: ->
#Defer the call till the content actually gets rendered, nanoscroller requires content to be visible
_.defer => @$el.find('.nano').nanoScroller()
_.defer => @$el.find('.nano').nanoScroller() unless @destroyed
updateProgress: (progress) ->
@loadProgress.progress = progress if progress > @loadProgress.progress

View file

@ -90,6 +90,7 @@ module.exports = class LadderSubmissionView extends CocoView
globals: ['Vector', '_']
protectAPI: true
includeFlow: false
executionLimit: 1 * 1000 * 1000
if spellID is "hear" then aetherOptions["functionParameters"] = ["speaker","message","data"]
aether = new Aether aetherOptions

View file

@ -19,7 +19,7 @@ module.exports = class ProblemAlertView extends View
context = super context
format = (s) -> s?.replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/\n/g, '<br>')
message = @problem.aetherProblem.message
age = @problem.aetherProblem.userInfo.age
age = @problem.aetherProblem.userInfo?.age
if age?
if /^Line \d+:/.test message
message = message.replace /^(Line \d+)/, "$1, time #{age.toFixed(1)}"

View file

@ -129,6 +129,7 @@ module.exports = class Spell
# TODO: Gridmancer doesn't currently work with protectAPI, so hack it off
protectAPI: not (@skipProtectAPI or window.currentView?.level.get('name').match("Gridmancer")) and writable # If anyone can write to this method, we must protect it.
includeFlow: false
executionLimit: 1 * 1000 * 1000
#console.log "creating aether with options", aetherOptions
aether = new Aether aetherOptions
workerMessage =

View file

@ -32,7 +32,7 @@
"firepad": "~0.1.2",
"marked": "~0.3.0",
"moment": "~2.5.0",
"aether": "~0.2.8",
"aether": "~0.2.9",
"underscore.string": "~2.3.3",
"firebase": "~1.0.2",
"catiline": "~2.9.3",

View file

@ -65,7 +65,7 @@
"redis": "",
"webworker-threads": "~0.4.11",
"node-gyp": "~0.13.0",
"aether": "~0.2.8",
"aether": "~0.2.9",
"JASON": "~0.1.3",
"JQDeferred": "~2.1.0"
},

View file

@ -22,7 +22,7 @@ transpileLevelSession = (sessionID, cb) ->
for thang, spells of submittedCode
transpiledCode[thang] = {}
for spellID, spell of spells
aetherOptions =
problems: {}
language: "javascript"
@ -32,43 +32,44 @@ transpileLevelSession = (sessionID, cb) ->
globals: ['Vector', '_']
protectAPI: true
includeFlow: false
executionLimit: 1 * 1000 * 1000
if spellID is "hear" then aetherOptions["functionParameters"] = ["speaker","message","data"]
aether = new Aether aetherOptions
transpiledCode[thang][spellID] = aether.transpile spell
conditions =
conditions =
"_id": sessionID
update =
update =
"transpiledCode": transpiledCode
"submittedCodeLanguage": "javascript"
query = LevelSession.update(conditions,update)
query.exec (err, numUpdated) -> cb err
findLadderLevelSessions = (levelID, cb) ->
queryParameters =
queryParameters =
"level.original": levelID + ""
submitted: true
selectString = "_id"
query = LevelSession.find(queryParameters).select(selectString).lean()
query.exec (err, levelSessions) ->
if err then return cb err
levelSessionIDs = _.pluck levelSessions, "_id"
async.eachSeries levelSessionIDs, transpileLevelSession, (err) ->
if err then return cb err
cb null
transpileLadderSessions = ->
queryParameters =
queryParameters =
type: "ladder"
"version.isLatestMajor": true
"version.isLatestMinor": true
selectString = "original"
query = Level.find(queryParameters).select(selectString).lean()
query.exec (err, ladderLevels) ->
throw err if err
ladderLevels = _.pluck ladderLevels, "original"
@ -77,5 +78,3 @@ transpileLadderSessions = ->
serverSetup.connectToDatabase()
transpileLadderSessions()