doc/about.html
author Andrey Skvortsov <andrej.skvortzov@gmail.com>
Thu, 28 Apr 2016 13:05:57 +0300
changeset 1507 d7f474d10210
parent 434 092060fd8afb
child 1513 b7b8d29e2a2d
permissions -rw-r--r--
fix issue with sometimes wrong return code of ProcessLogger


As a result of wrong return code Beremiz gives folowing traceback:
Traceback (most recent call last):
File "./Beremiz.py", line 850, in OnMenu
getattr(self.CTR, method)()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 925, in _Build
IECGenRes = self._Generate_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 568, in _Generate_SoftPLC
return self._Compile_ST_to_SoftPLC()
File "/home/developer/WorkData/PLC/beremiz/beremiz/ProjectController.py", line 661, in _Compile_ST_to_SoftPLC
C_files.remove("POUS.c")
ValueError: list.remove(x): x not in list

The problem is that both threads (for reading stdout and stderr) call self.Proc.poll(),
that updates internal returncode field. This call is done without any locking and the first thread gets correct result,
but other gets 0 as retval. If 0 gets thread, that afterwards calls callback finish, then wrong return code is returned
to the parent. Now only the thread with a callback polls for the return code, other thread just checked local value.

Additionally function spin() waits now until all threads finish reading their pipes, so the results are always correct.
120
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     1
<HTML>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     2
<BODY>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     3
<CENTER>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     4
<IMG SRC="../images/splash.png">
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     5
<BR><BR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     6
<font size="3">Beremiz is an Open Source framework for automation.</font>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     7
<BR><BR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     8
<a href="http://www.beremiz.org/">http://www.beremiz.org/</a>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
     9
<BR><BR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    10
<TABLE border="0">
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    11
  <TR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    12
    <TD align="right" valign="top">
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    13
      Contributor :
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    14
    </TD>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    15
    <TD align="left" valign="top">
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    16
      University of Porto<BR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    17
      <a href="http://www.fe.up.pt/si/web_page.inicial">http://www.fe.up.pt/si/web_page.inicial</a>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    18
    </TD>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    19
  </TR>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    20
</TABLE>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    21
</CENTER>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    22
</BODY>
8c3150858dd3 create doc directory and add about.html + manual_beremiz.pdf
greg
parents:
diff changeset
    23
</HTML>