Hangs with intensities < 1 #22

Closed
Bengt opened this Issue Oct 11, 2012 · 3 comments

Projects

None yet

2 participants

@Bengt

Noisy will hang and consume as much CPU circles, as a available for intensities < 1 on certain sizes. Firefox (15) will ask to stop the script, Chrome (22) will sometimes notice for unresponsive tabs an offer to stop it, sometimes Chrome will just keep the script running till the tab is closed. Opera (12) also just keeps going, until the tab is closed.

I isolated this as a minimal test case:

<html>
    <body>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/noisy/1.1/jquery.noisy.min.js"></script>
        <script>
            $('body').noisy({
                'intensity' : 0.234,
                'size' : 100,
                'opacity' : 0.123,
                'fallback' : '',
                'monochrome' : true
            }).css('background-color', '#eaeaea');
        </script>
    </body>
</html>

I ran these tests to isolate intensity as the cause:

'size' : 99 hangs
'size' : 100 works
'size' : 101 hangs
'size' : 99 , 'intensity : '1.0 works
'size' : 100 , 'intensity' : '1.0 works
'size' : 101, 'intensity' : '1.0 works
'size' : 99, 'opacity : '1.0 hangs
'size' : 100, 'opacity : '1.0 works
'size' : 101, 'opacity : '1.0 hangs

@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22
Silly bug. Stemmed from only having tested multiples of 100 for the size option.
d60e989
@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22 6657a2d
@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22 3da24fc
@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22 283114b
@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22 9ce2e5d
@DanielRapp DanielRapp added a commit that referenced this issue Oct 11, 2012
@DanielRapp Fixed issue #22 009a8c2
@DanielRapp
Owner

That was a silly bug.
It was getting stuck in an infinite loop when number of pixels (size * intensity) wasn't a whole number.
Thank you for letting me know, and for the excellent bug report.

@DanielRapp DanielRapp closed this Oct 11, 2012
@Bengt

Great, thanks for fixing this so quickly.

@Bengt

Since this was quite a severe bug and and the last pull to cdnjs/cdnjs was a year ago, would this be worth a release? Perhaps a bugfix release called 1.1.1?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment