pecan icon indicating copy to clipboard operation
pecan copied to clipboard

`run.write.configs()` opens too many database connections

Open Aariq opened this issue 3 years ago • 1 comments

https://github.com/PecanProject/pecan/blob/ae89856f24a62cd83a06fa0c59e7f902df4f63c5/base/workflow/R/run.write.configs.R#L37

Because this line is inside of a for-loop, I think it's opening (or trying to open) a number of database connections equal to the number of PFTs specified. The on.exit() line also gets called once per PFT and prints a warning that the connection may have already been closed.

Aariq avatar Jul 18 '22 22:07 Aariq

With 5 PFTs specified I get 4 warnings:

2022-07-18 22:22:38 WARN   [PEcAn.DB::db.close] : 
   Connection might have been closed already. 
2022-07-18 22:22:38 WARN   [PEcAn.DB::db.close] : 
   Connection might have been closed already. 
2022-07-18 22:22:38 WARN   [PEcAn.DB::db.close] : 
   Connection might have been closed already. 
2022-07-18 22:22:38 WARN   [PEcAn.DB::db.close] : 
   Connection might have been closed already. 

Aariq avatar Jul 18 '22 22:07 Aariq