Race in ETimeFormat [PATCH]

Thomas Leonard <tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]> Thu, 28 Jul 2011 10:15:58 +0100
Newsgroups gmane.comp.lang.e.general
Message-ID <[email protected]>
If two vats use ETimeFormat at once, it may fail. Test case:


def seedVat := <elang:interp.seedVatAuthor>(<unsafe>)
seedVat(`def timeFormat := 
<import:org.erights.e.develop.format.makeETimeFormat>
def random := <unsafe:java.util.makeRandom>()
while (true) { timeFormat.formatTime(random.nextInt()) }`)

def timeFormat := <import:org.erights.e.develop.format.makeETimeFormat>
while (true) {timeFormat.formatTime(0) }


Sample output:

$ rune time.e
# problem: <ArrayIndexOutOfBoundsException: 13>
#
#   - static ETimeFormat#formatTime(long)
#   . <makeETimeFormat>.formatTime(0)
#   @ formatTime/1: </opt/src/e/src/time.e#:span::7:25::7:34>
#   - __main$_#run/0
#   . <_>()
#   - Loop#run(LoopBody)
#   . <__loop>(<_>)
#   @ run/1
#   - EExpr#evalToPair(Scope)
#   . e`escape __break {\n    __lo...    }\n        }\n 
})\n}`.evalToPair(<a Scope>)
#   @ evalToPair/1: 
<jar:file:/home/tal/.cache/0install.net/implementations/sha1new%3d489654cfd0f86baaf3223c77418b2e3427255731/e.jar!/org/erights/e/elang/cmd/cmdMakerMaker.emaker#:span::128:57::128:66>


Patch:

https://gitorious.org/~tal-itinnov/repo-roscidus/it-innovation/commit/057f7265156b930493ae217277a4e93e442a3400


-- 
Dr Thomas Leonard
IT Innovation Centre
Gamma House, Enterprise Road,
Southampton SO16 7NS, UK


tel: +44 23 8059 8866

mailto:tal-v5nx5w6akNyLE8xUarVfuPLx9OUvmyODWmv/[email protected]
http://www.it-innovation.soton.ac.uk/