This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rajeevkchaurasia
Recipients rajeevkchaurasia
Date 2021-06-14.04:36:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1623645412.68.0.708640835339.issue44415@roundup.psfhosted.org>
In-reply-to
Content
I am running an application using cronjob. This application runs on Linux(X86_64) platform where inside a loop we have print() and sys.stdout.flush() statements. This loop iterates around 500 times and after the loop we have few more sys.stdout.flush() and print() statements. 

When I am running same application on terminal (without cronjob) then it is working fine.

Inside the loop everything is working fine but application is hanging after the loop. I put some debug statements and I found it is hanging on print() and sys.stdout.flush().


Code logic:-

for x in range(500):
  print(x)
  print ("something")
  sys.stdout.flush()
self.logger.info("A")
sys.stdout.flush()     #1 
self.logger.info("B")
print ("Hello")        #2
self.logger.info("C")
print ("Bye")          #3
self.logger.info("D")
-----------------------------------------
"A" is getting printed in log file and nothing after that but-
If I comment #1 then I get "B" as well in the log file.
If I comment #2 then I get "C" as well in the log file
If I comment #3 then I get "D" as well in the log file.

-----------------------------------------
ps results-
[root@scao05adm07 ~]# ps -ef|grep exachk
root     239265  98963  0 Jun11 ?        00:00:00 sh /opt/oracle.ahf/bin/exachk -silentforce -showpass -dball -nocvu -autorun_id DEFAULT
root     239706 239265  0 Jun11 ?        00:00:35 /opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce -showpass -dball -nocvu -autorun_id DEFAULT
root     277938 239706  0 Jun11 ?        00:00:00 sh /opt/oracle.ahf/exachk/exachk -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0
root     278989 277938  0 Jun11 ?        00:12:26 /opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0
root     281983 278989  0 Jun11 ?        00:00:27 /opt/oracle.ahf/python/bin/python /opt/oracle.ahf/exachk/exachk.py -silentforce -showpass -dball -nocvu -autorun_id DEFAULT -localonly -sudo_remoterun 0

-----------------------------------------
# uname -a
Linux ************ 4.14.35-1902.306.2.2.el7uek.x86_64 #2 SMP Thu Nov 19 18:09:09 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
-----------------------------------------
I believe this issue is related to standard output buffer but I am not able to find a fix for it.

Please help.
-Rajeev
History
Date User Action Args
2021-06-14 04:36:52rajeevkchaurasiasetrecipients: + rajeevkchaurasia
2021-06-14 04:36:52rajeevkchaurasiasetmessageid: <1623645412.68.0.708640835339.issue44415@roundup.psfhosted.org>
2021-06-14 04:36:52rajeevkchaurasialinkissue44415 messages
2021-06-14 04:36:51rajeevkchaurasiacreate