This week the task is very time consuming, because I spent most of the time debugging and reading the logs in the terminal. As I got to know from my colleague Jeunn Hao, that the simulation still does not work 100% of the time. I decided to read the code and logs all over again, to determine where is the main problem that causes it to be inconsistent.
The Inconsistent Emission
As I trace the bug, reading the logs again and again, and comparing it the new projects that I had created. I noticed that they are really inconsistent, mainly due to the two JSignal that had been implemented in JavaScript. The JSignal is sending emission into two different Wt widgets, where each widget will trigger another WResource.
This is still not a problem until I found that each JSignal emission is a new event. Thus, the doJavaScript that previously invoke in the first widget is not executed until the JSignal for the second widget is emitted. This causes the JavaScript to be executed sometimes, depends on whether the second JSignal is emitted earlier than the first JSignal.
The problem is created by the usage of doJavaScript after the Wt done() signal. The solution to ensure that the doJavaScript is always invoked regardless the new event starts, is to use deferRendering
and resumeRendering
as discussed in my previous blog.
The File Dependencies
The discovery on the logs and code does pay off! I noticed that there are some weird logs that I found when comparing the inconsistencies of the JSignal emission.
There are bugs that I found and solved for the week, where the first JSignal emission will triggers a WResource which would handle the synthesis process. But before the synthesis starts, the WResource will require a UCF file produced from the WResource that triggers by the second JSignal. These causes the error to be occur during synthesis because sometimes the UCF file is not produced, due to the inconsistent JSignal emission, which might be sometimes earlier or later, affecting the generation of UCF file to be earlier or later too.
Besides, there are actually a bug where a file to be generated based on a generated ELF file during a WResource. And the generation of the ELF file actually starts after the WResource, and it requires another file generated from the WResource as well. This causes the file that should be generated based on ELF file to be outdated everytime!
I guess all these bugs were occurred due to lack of communication by the other interns previously, and solving these bugs are sometimes a headache because it may infer other bug as well.
0 Comments