After closing frontend socket, set MyProcPort->sock = -1 to ensure that subsequent I/O attempts fail cleanly.  I'm speculating about failure scenarios in which we do pq_close, then something in a proc_exit routine opens a file (re-using that kernel FD number), then something else fails and tries to write an elog message to the frontend ... message ends up in opened file, oops.  No known examples of this but it seems like a potential hole.
After closing frontend socket, set MyProcPort->sock = -1 to ensure that
subsequent I/O attempts fail cleanly.  I'm speculating about failure
scenarios in which we do pq_close, then something in a proc_exit routine
opens a file (re-using that kernel FD number), then something else
fails and tries to write an elog message to the frontend ... message
ends up in opened file, oops.  No known examples of this but it seems
like a potential hole.

rvs/gpdb,randomtask1155/gpdb,50wu/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,janebeckman/gpdb,arcivanov/postgres-xl,Postgres-XL/Postgres-XL,ahachete/gpdb,arcivanov/postgres-xl,atris/gpdb,postmind-net/postgres-xl,rubikloud/gpdb,Postgres-XL/Postgres-XL,greenplum-db/gpdb,foyzur/gpdb,yuanzhao/gpdb,snaga/postgres-xl,xinzweb/gpdb,janebeckman/gpdb,kaknikhil/gpdb,yuanzhao/gpdb,xuegang/gpdb,kmjungersen/PostgresXL,foyzur/gpdb,Quikling/gpdb,atris/gpdb,50wu/gpdb,janebeckman/gpdb,lisakowen/gpdb,0x0FFF/gpdb,tangp3/gpdb,greenplum-db/gpdb,greenplum-db/gpdb,Chibin/gpdb,lintzc/gpdb,atris/gpdb,ahachete/gpdb,xinzweb/gpdb,rubikloud/gpdb,Chibin/gpdb,randomtask1155/gpdb,Chibin/gpdb,kaknikhil/gpdb,lintzc/gpdb,ovr/postgres-xl,janebeckman/gpdb,chrishajas/gpdb,yuanzhao/gpdb,techdragon/Postgres-XL,adam8157/gpdb,0x0FFF/gpdb,jmcatamney/gpdb,tangp3/gpdb,lpetrov-pivotal/gpdb,rvs/gpdb,0x0FFF/gpdb,lintzc/gpdb,chrishajas/gpdb,foyzur/gpdb,Quikling/gpdb,techdragon/Postgres-XL,oberstet/postgres-xl,edespino/gpdb,lisakowen/gpdb,jmcatamney/gpdb,Chibin/gpdb,kmjungersen/PostgresXL,lpetrov-pivotal/gpdb,tpostgres-projects/tPostgres,randomtask1155/gpdb,rubikloud/gpdb,foyzur/gpdb,jmcatamney/gpdb,tpostgres-projects/tPostgres,randomtask1155/gpdb,ovr/postgres-xl,lisakowen/gpdb,ashwinstar/gpdb,royc1/gpdb,ahachete/gpdb,yuanzhao/gpdb,xinzweb/gpdb,postmind-net/postgres-xl,greenplum-db/gpdb,xuegang/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,edespino/gpdb,lintzc/gpdb,CraigHarris/gpdb,zeroae/postgres-xl,royc1/gpdb,randomtask1155/gpdb,cjcjameson/gpdb,arcivanov/postgres-xl,kaknikhil/gpdb,0x0FFF/gpdb,xinzweb/gpdb,kaknikhil/gpdb,0x0FFF/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,tangp3/gpdb,Chibin/gpdb,Postgres-XL/Postgres-XL,zeroae/postgres-xl,edespino/gpdb,yazun/postgres-xl,cjcjameson/gpdb,tangp3/gpdb,kaknikhil/gpdb,Quikling/gpdb,chrishajas/gpdb,Chibin/gpdb,yazun/postgres-xl,greenplum-db/gpdb,cjcjameson/gpdb,CraigHarris/gpdb,0x0FFF/gpdb,kaknikhil/gpdb,lisakowen/gpdb,arcivanov/postgres-xl,rubikloud/gpdb,ahachete/gpdb,xuegang/gpdb,techdragon/Postgres-XL,50wu/gpdb,xinzweb/gpdb,ovr/postgres-xl,lpetrov-pivotal/gpdb,chrishajas/gpdb,zaksoup/gpdb,adam8157/gpdb,yuanzhao/gpdb,randomtask1155/gpdb,oberstet/postgres-xl,lintzc/gpdb,rvs/gpdb,royc1/gpdb,rubikloud/gpdb,ashwinstar/gpdb,Quikling/gpdb,rvs/gpdb,kmjungersen/PostgresXL,janebeckman/gpdb,CraigHarris/gpdb,xinzweb/gpdb,CraigHarris/gpdb,pavanvd/postgres-xl,zaksoup/gpdb,zaksoup/gpdb,snaga/postgres-xl,cjcjameson/gpdb,cjcjameson/gpdb,janebeckman/gpdb,xinzweb/gpdb,yuanzhao/gpdb,atris/gpdb,Quikling/gpdb,foyzur/gpdb,xuegang/gpdb,edespino/gpdb,ovr/postgres-xl,Quikling/gpdb,rvs/gpdb,foyzur/gpdb,atris/gpdb,ahachete/gpdb,ahachete/gpdb,janebeckman/gpdb,royc1/gpdb,50wu/gpdb,ovr/postgres-xl,adam8157/gpdb,CraigHarris/gpdb,pavanvd/postgres-xl,randomtask1155/gpdb,chrishajas/gpdb,techdragon/Postgres-XL,oberstet/postgres-xl,adam8157/gpdb,edespino/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,chrishajas/gpdb,50wu/gpdb,foyzur/gpdb,0x0FFF/gpdb,ashwinstar/gpdb,lisakowen/gpdb,kaknikhil/gpdb,jmcatamney/gpdb,royc1/gpdb,xuegang/gpdb,cjcjameson/gpdb,ashwinstar/gpdb,yazun/postgres-xl,lisakowen/gpdb,oberstet/postgres-xl,jmcatamney/gpdb,lpetrov-pivotal/gpdb,lpetrov-pivotal/gpdb,greenplum-db/gpdb,ahachete/gpdb,zaksoup/gpdb,lisakowen/gpdb,kaknikhil/gpdb,xuegang/gpdb,xuegang/gpdb,zaksoup/gpdb,snaga/postgres-xl,royc1/gpdb,janebeckman/gpdb,yuanzhao/gpdb,yazun/postgres-xl,postmind-net/postgres-xl,CraigHarris/gpdb,Postgres-XL/Postgres-XL,rubikloud/gpdb,adam8157/gpdb,arcivanov/postgres-xl,oberstet/postgres-xl,zaksoup/gpdb,ashwinstar/gpdb,edespino/gpdb,rubikloud/gpdb,tpostgres-projects/tPostgres,xinzweb/gpdb,50wu/gpdb,foyzur/gpdb,xuegang/gpdb,kaknikhil/gpdb,rubikloud/gpdb,rvs/gpdb,rvs/gpdb,kaknikhil/gpdb,CraigHarris/gpdb,50wu/gpdb,Chibin/gpdb,chrishajas/gpdb,edespino/gpdb,Chibin/gpdb,lintzc/gpdb,tangp3/gpdb,atris/gpdb,rvs/gpdb,tangp3/gpdb,0x0FFF/gpdb,Quikling/gpdb,adam8157/gpdb,zeroae/postgres-xl,lisakowen/gpdb,rvs/gpdb,Quikling/gpdb,tpostgres-projects/tPostgres,techdragon/Postgres-XL,edespino/gpdb,adam8157/gpdb,janebeckman/gpdb,ashwinstar/gpdb,atris/gpdb,ahachete/gpdb,janebeckman/gpdb,lintzc/gpdb,lintzc/gpdb,edespino/gpdb,arcivanov/postgres-xl,lpetrov-pivotal/gpdb,Quikling/gpdb,zeroae/postgres-xl,CraigHarris/gpdb,pavanvd/postgres-xl,xuegang/gpdb,zaksoup/gpdb,tangp3/gpdb,kmjungersen/PostgresXL,yuanzhao/gpdb,edespino/gpdb,tangp3/gpdb,royc1/gpdb,royc1/gpdb,Quikling/gpdb,zaksoup/gpdb,jmcatamney/gpdb,lpetrov-pivotal/gpdb,greenplum-db/gpdb,chrishajas/gpdb,snaga/postgres-xl,tpostgres-projects/tPostgres,Chibin/gpdb,lpetrov-pivotal/gpdb,snaga/postgres-xl,cjcjameson/gpdb,cjcjameson/gpdb,greenplum-db/gpdb,cjcjameson/gpdb,Postgres-XL/Postgres-XL,rvs/gpdb,lintzc/gpdb,pavanvd/postgres-xl,randomtask1155/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,yazun/postgres-xl,adam8157/gpdb,postmind-net/postgres-xl,50wu/gpdb,atris/gpdb,yuanzhao/gpdb,postmind-net/postgres-xl,Chibin/gpdb