fortran-lang / playground

An interactive Fortran playground
MIT License
34 stars 12 forks source link

Printing the output of programs to stdout #42

Closed milancurcic closed 2 years ago

milancurcic commented 2 years ago

Currently, the backend prints the output of programs to stdout, see lines 80 and 90 in backend/app.py:

https://github.com/fortran-lang/playground/blob/17abc35c5259d46503394b7a2def499cf070ebbd/backend/app.py#L78-L90

In production, we redirect stdout and stderr to their respective log files. It's easy for a playground user to create very large output (e.g. by printing values of a large array). This has two issues:

  1. The log file can quickly become very large and fill up the space on the VM;
  2. Such requests create large writes to disk that hinder the performance of the VM otherwise.

I think we should remove these print statements. What do you think?

ashirrwad commented 2 years ago

Yes in a production environment it's not beneficial printing them to the console. There's a problem though since we use FPM even the stderr statements are given out to stdout which means we will have to parse every output before storing the errors in a log file. I'll try experimenting with solutions.