Forum Discussion

goya's avatar
goya
Visitor
14 years ago

the following code reboots my roku 2 xs

the following code reboots my roku 2 xs

the first 2 benchs if runned by themselves are not a problem.
it appears the code crashes if after integerArithmeticMix runs... My debug console closes and I do not see any messages. All that happens is the roku freezes then reboots on its on...

so why is messing up the vm, looks live vm bug... since the code runs by itself... it just leaves the vm unstable...
or its actually running... Maybe it's eval() that is causing the problem...

Are there any log files I can look at after a reboot to see why it reboots. Too bad I don't have access to linux/c level I could debug this one. And if I had source code to BrightScript I could fix it... πŸ˜‰

here is the full source code listing that crashes (reboots) the box...

sub bench(n)
end sub

sub sieve(n)
flags = CreateObject("roArray", 8192 + 1, true)

count = 0

while n > 0
n = n - 1

count = 0

for i = 2 to 8192
flags[i] = true
end for

for i = 2 to 8192
if (flags[i])
' remove all multiples of prime: i
for k = i + i to 8192 step i
flags[k] = false
end for

count = count + 1
end if
end for
end while
end sub

sub integerArithmeticMix(n%)
r% = 1%

for i% = 1% to n%
r% = r% - i%
r% = r% + i%
r% = r% * i%
r% = r% / i%
r% = r% ^ i%
end for
end sub

sub floatArithmeticMix(n!)
r! = 1.0!

for i! = 1.0! to n!
r! = r! - i!
r! = r! + i!
r! = r! * i!
r! = r! / i!
r! = r! ^ i!
end for
end sub

sub doubleArithmeticMix(n#)
r# = 1.0#

for i# = 1.0# to n#
r# = r# - i#
r# = r# + i#
r# = r# * i#
r# = r# / i#
r# = r# ^ i#
end for
end sub

sub RunBenchmarks()
benchmarks = [["bench",1],["sieve",10],["integerArithmeticMix",10],["floatArithmeticMix",10],["doubleArithmeticMix",10]]

screen = CreateObject("roParagraphScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)

screen.SetTitle("Benchmark Suite")

screen.AddButton(1, "Close")

screen.Show()

dialog = CreateObject("roOneLineDialog")
dialog.SetTitle("Running benchmarks ...")
dialog.ShowBusyAnimation()
dialog.Show()

for each benchmark in benchmarks
dialog.SetTitle("Running benchmark " + benchmark[0] + "(" + Stri(benchmark[1]) + ") ...")

st = UpTime(0)
Eval(benchmark[0] + "(" + Stri(benchmark[1]) + ")")
et = UpTime(0)

screen.AddHeaderText(benchmark[0] + "(" + Stri(benchmark[1]) + "): " + Str(et-st))
end for

dialog.Close()

closed = false

' event loop
while true
msg = wait(0, port) ' wait for an event

if type(msg) = "roParagraphScreenEvent"
if msg.isButtonPressed()
buttonIndex = msg.GetIndex()

if buttonIndex = 1
exit while
end if
else if msg.isScreenClosed()
exit while
end if
end if
end while

screen.Close()
end sub


sub DisplayMainScreen()
screen = CreateObject("roParagraphScreen")
port = CreateObject("roMessagePort")
screen.SetMessagePort(port)

screen.SetTitle("Benchmark Suite")

screen.AddButton(1, "Start")
screen.AddButton(2, "Close")

screen.Show()

' event loop
while true
msg = wait(0, port) ' wait for an event

if type(msg) = "roParagraphScreenEvent"
if msg.isButtonPressed()
buttonIndex = msg.GetIndex()

if buttonIndex = 1
RunBenchmarks()
else
exit while
end if
else if msg.isScreenClosed()
exit while
end if
end if
end while

screen.Close()
' anytime all screens within a channel are closed, the channel will exit
end sub

sub Main()
DisplayMainScreen()
end sub

8 Replies

  • i have some good / bad news

    the code runs great on older roku xd model

    i guess i paid to be a beta tester, joy πŸ˜‰
  • jbrave's avatar
    jbrave
    Channel Surfer
    for starters, just put a print statement after each line, see if you can figure out the last line to execute before it rebooted, that is usually the one that caused it, or nearby.
  • jbrave's avatar
    jbrave
    Channel Surfer
    Whatever it is, it appears to occur in the doubleArithmetic sub

    - Joel
  • Apparently Brightscript is not properly handling a for loop which uses a double variable as the index (generally not a good idea, but it shouldn't crash). I have filed a bug report for this.

    --Mark
  • jbrave's avatar
    jbrave
    Channel Surfer
    Output:

    entered sieve
    exiting sieve
    entered integer arithmetic
    exiting integer arithmetic
    enter float
    exit float
    entered double
    first line executed

    sub doubleArithmeticMix(n#)
    ?"entered double"
    r# = 1.0#
    ?"first line executed"
    for i# = 1.0# to n#
    ?"entered for loop"
    r# = r# - i#
    ?"line1 executed"
    r# = r# + i#
    ?"line2 executed"
    r# = r# * i#
    ?"line3 executed"
    r# = r# / i#
    ?"line4 executed"
    r# = r# ^ i#
    ?"line5 executed"
    ?i#
    end for
    ?"exit double"
    end sub
  • thank you

    please let me know when there is fix release out so that i can rerun my benchmark suite on my roku 2 xs

    right now its runs great on my roku xd

    best regards
  • jbrave's avatar
    jbrave
    Channel Surfer
    Whoa, I didn't know about that lawsuit. I just read up a bit on it.

    Apparently its about having a button in your "Lite" app that links to a paid app. That applies to almost every other free app in the Apple app store, and now on Roku, we have that functionality available too. The patent system needs to be dismantled be revised in some fundamental way.

    - Joel
  • "jbrave" wrote:
    Whoa, I didn't know about that lawsuit. I just read up a bit on it.

    Apparently its about having a button in your "Lite" app that links to a paid app. That applies to almost every other free app in the Apple app store, and now on Roku, we have that functionality available too. The patent system needs to be dismantled be revised in some fundamental way.

    - Joel


    re: patent system

    they've actually just made it even worse...

    it like game over you lose worldwide forever, except for mega multinational corporation

    basically its not first to discover/create/release, but first to file...

    who can afford to file all day, not small inventors...

    basically it's going to be a world of pain for small corporations and inventors...

    and we are all going to pay for it...

    basically you have patent trolls legal firms setting up shell corporations to go after companies like roku

    think, sco vs linux, extortion racket, spreading fud... backed by huge corporation like microsoft...

    but now its the wide west... you have mercendart lone-wolf mega legal firms getting in on action backed by multinational wolf pack hedge funds...

    even microsoft has to look over their shoulders

    they are going out and buying enmass patent rights and then cashing in / collection royalty, like mafia protection racket...

    prepare to pay for it over and over again in every thing you buy...

    wait til ibm get patent for method by which one can make money with a computer device...