Asynchronous and Messaging

Our extensive unit test suite discovered, that
  • if two WebKit instances are loaded simultaneously, which use the same JS file from the local disk, then initializing one of the JS engines sometimes fails.
The average WebKit programmer will never experience this. The average WebKit programmer uses WebKit to make a web browser. And web browsers do not create many instances simultaneously. You press CTRL-T to open a new tab. Then another. Not two at the same time. Especially not from the local file system. Maybe that's the reason why nobody discovered the "feature" before.

Anyway, this means, that creation of WebKits must be serialized. This in turn, introduces all kinds of asynchronous behavior, which must be handled properly in many places. Asynchronous programming is always more challenging than spaghetti coding. Fortunately the client is message based. The image shows events which wait for other things to complete, before they are forwarded. In other words: the display must be loaded before it can show something. As simple as that.

This kept me busy several evenings and made a huge commit. Now I can continue with the setup/install process.

2 comments:

bfulgham said...

Nice catch!

Did you get a chance to file a bug about this? I think our test infrastructure does run simultaneous tests, but almost certainly not on the same file (in the same process).

Heiner said...

No I did not. I admit I was too lazy, I was not sure, that I diagnosed correctly, and I was again too lazy to make a simple showcase and prove it.

Post a Comment