liuzhe02 / bigbluebutton

Automatically exported from code.google.com/p/bigbluebutton
0 stars 0 forks source link

Race condition in whiteboard function after uploading a pdf #1661

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As mentioned in thread 
https://groups.google.com/forum/#!topic/bigbluebutton-dev/NXFDMRKiU8U I found a 
reproduceable Bug in 0.81rc3.

When you upload a pdf file and and instantly start drawing you either get 
disconnected or get the following exception:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: 
http://demo.bigbluebutton.org/bigbluebutton/presentation/2c1c1763f938f7a591c8ca5
6111c7898edca7e72-1382021519409/2c1c1763f938f7a591c8ca56111c7898edca7e72-1382021
519409/defaultbbb/slide/1
    at org.bigbluebutton.modules.present.managers::Slide()[/var/lib/hudson/jobs/bbb-client/workspace/src/org/bigbluebutton/modules/present/managers/Slide.as:48]
    at org.bigbluebutton.modules.present.business::PresentationService/parse()[/var/lib/hudson/jobs/bbb-client/workspace/src/org/bigbluebutton/modules/present/business/PresentationService.as:104]
    at org.bigbluebutton.modules.present.business::PresentationService/handleComplete()[/var/lib/hudson/jobs/bbb-client/workspace/src/org/bigbluebutton/modules/present/business/PresentationService.as:79]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

After Fred suggested it might be a race condition, I tried to reproduce it with 
a little bit of delay after the upload. No Problem occurred.

To verify I did the instant drawing again and I got disconnected. After Fred 
pointed me into the direction of a race condition I looked closer and it 
appears that Im trying to draw on the "old" presentation (in my case the 
default). That seems to crash it.

Regards,
Mitja

Original issue reported on code.google.com by mitja.th...@ewetel.de on 18 Oct 2013 at 9:14

GoogleCodeExporter commented 9 years ago
I think I know what we can do.

There's an even that fires when a presentation is ready to be downloaded, 
https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml#L104. And there 
is an event that fires when the presentation is finished downloading here, 
https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
src/org/bigbluebutton/modules/present/business/PresentationService.as#L149.

If we disable the whiteboard (I think?) when the loading starts and reenable 
the whiteboard when the loading is over I think the race condition will be 
avoided.

Original comment by capil...@gmail.com on 18 Oct 2013 at 6:51

GoogleCodeExporter commented 9 years ago
I've solved the disconnect issue, but now I'm getting a different error.

TypeError: Error #1009: Cannot access a property or method of a null object 
reference.
    at org.bigbluebutton.modules.whiteboard.models::Presentation/getAnnotation()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/models/Presentation.as:44]
    at org.bigbluebutton.modules.whiteboard.models::WhiteboardModel/getAnnotation()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/models/WhiteboardModel.as:74]
    at org.bigbluebutton.modules.whiteboard::WhiteboardCanvasDisplayModel/redrawGraphic()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as:418]
    at org.bigbluebutton.modules.whiteboard::WhiteboardCanvasDisplayModel/zoomCanvas()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/WhiteboardCanvasDisplayModel.as:389]
    at org.bigbluebutton.modules.whiteboard.views::WhiteboardCanvas/zoomCanvas()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardCanvas.mxml:285]
    at org.bigbluebutton.modules.present.ui.views::SlideView/zoomCanvas()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml:473]
    at org.bigbluebutton.modules.present.ui.views::SlideView/fitSlideToLoader()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml:217]
    at org.bigbluebutton.modules.present.ui.views::SlideView/onMouseMove()[/home/firstuser/dev/bigbluebutton/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml:168]

Original comment by capil...@gmail.com on 18 Oct 2013 at 11:20

GoogleCodeExporter commented 9 years ago
This pull request, https://github.com/bigbluebutton/bigbluebutton/pull/276, 
hopefully solves the race condition, but it should really be double checked by 
someone else.

Original comment by capil...@gmail.com on 19 Oct 2013 at 1:43

GoogleCodeExporter commented 9 years ago

Original comment by ffdixon@gmail.com on 19 Oct 2013 at 7:58

GoogleCodeExporter commented 9 years ago
Issue 1608 has been merged into this issue.

Original comment by ffdixon@gmail.com on 19 Oct 2013 at 9:56

GoogleCodeExporter commented 9 years ago
Hey thank you for the fast work.
I did double check with your commit.

Sadly changing the tool wasnt the solution. I could still break it by changing 
it to some random whiteboard tool and draw. Regarding that I did this with a 
pdf at the size of a couple of kb which does leave me just a certain time 
margin to break it, I think this can be even more problematic if some larger 
PDF is used because the uploadtime is longer.

Maybe an easy solution in addition to your switching to pan/zoom would be to 
hide the whiteboard toolbar, too. That way I couldn't get a painting tool of 
some kind while the upload is not yet finished.

Original comment by mitja.th...@ewetel.de on 21 Oct 2013 at 2:41

GoogleCodeExporter commented 9 years ago
The issue with hiding the toolbar is that the toolbar visibility is currently 
tied to mousing into and out of anything in the presentation window. The 
listeners are all here, 
https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client/
src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml#L234. As 
soon as the presenter moused over anything the toolbar would show up again.

Original comment by capil...@gmail.com on 21 Oct 2013 at 6:28

GoogleCodeExporter commented 9 years ago
Well would could also change the whiteboardAccess settig to some value like 
"none" until the loading is done. That way the whiteboard toolbar shouldn't 
become visible because the toolbarAllowed() function 
(https://github.com/bigbluebutton/bigbluebutton/blob/master/bigbluebutton-client
/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml#L293) 
would return false.

Still while writing this it seems to me more like a hotfix rather then a real 
solution. I'll take some time today looking a bit more into the code and let 
you know if I come up with a more elegant solution.

Original comment by mitja.th...@ewetel.de on 22 Oct 2013 at 8:24

GoogleCodeExporter commented 9 years ago
I'm going to try adding two new properties to track whether the mouse is over 
the window and whether the page has been loaded. Then every time one of them 
changes it will update the visibility of the toolbar. It should be more robust 
this way.

Original comment by capil...@gmail.com on 22 Oct 2013 at 4:22

GoogleCodeExporter commented 9 years ago
I think my pull request should now work. As soon as the client is notified that 
a new presentation is ready to be loaded the selected tool is switched to 
pan/zoom and the toolbar is hidden. Once any slide finishes loading the toolbar 
will appear.

Original comment by capil...@gmail.com on 22 Oct 2013 at 9:15

GoogleCodeExporter commented 9 years ago
My changes have been merged in now.

Original comment by capil...@gmail.com on 22 Oct 2013 at 10:08

GoogleCodeExporter commented 9 years ago
Thank you Chad!

Original comment by ffdixon@gmail.com on 22 Oct 2013 at 11:52