autopkg / hansen-m-recipes

My recipes for Autopkg - https://github.com/autopkg
27 stars 50 forks source link

BESPythonAPI.install fails #166

Closed jgstew closed 4 years ago

jgstew commented 4 years ago
autopkg install BESPythonAPI
Processing BESPythonAPI.install...
WARNING: BESPythonAPI.install is missing trust info and FAIL_RECIPES_WITHOUT_TRUST_INFO is not set. Proceeding...
[Errno 9] Bad file descriptor
Failed.

The following recipes failed:
    BESPythonAPI.install
        Error in com.github.hansen-m.install.BESPythonAPI: Processor: Installer: Error: [Errno 9] Bad file descriptor

The following new items were downloaded:
    Download Path                                                                                               
    -------------                                                                                               
    /Users/jgstew/Library/AutoPkg/Cache/com.github.hansen-m.install.BESPythonAPI/downloads/BESEngine.zip  

The following packages were built:
    Identifier                Version  Pkg Path                                                                                              
    ----------                -------  --------                                                                                              
    edu.psu.pkg.BESPythonAPI  2.0      /Users/jgstew/Library/AutoPkg/Cache/com.github.hansen-m.install.BESPythonAPI/BESEngine-2.0.pkg 
rustymyers commented 4 years ago

autopkg repo-update all && autopkg run -vv BESPythonAPI.install

Try again...I added the path to the pkg in the install recipe. -vv will show verbose output in autopkg run.

jgstew commented 4 years ago

Is there a command switch to force AutoPkg to run it even if the download didn't change?

jgstew commented 4 years ago

I deleted the cache, that seemed to force it to retry, new errors:

Installer: Connecting
Installer: Sending installation request
Installer: STATUS:installer: Package name is BESEngine-2.0
Installer: STATUS:installer: Upgrading at base path /
Installer: STATUS:installer:PHASE:Preparing for installation…
Installer: STATUS:installer:PHASE:Preparing the disk…
Installer: STATUS:installer:PHASE:Preparing BESEngine-2.0…
Installer: STATUS:installer:PHASE:Waiting for other installations to complete…
Installer: STATUS:installer:PHASE:Configuring the installation…
Installer: STATUS:installer:STATUS:
Installer: STATUS:installer:%46.309226
Installer: STATUS:installer:PHASE:Moving items into place…
Installer: STATUS:installer:PHASE:Validating packages…
Installer: STATUS:installer:%97.750000
Installer: STATUS:installer:STATUS:
Installer: STATUS:installer:PHASE:Finishing the Installation…
Installer: STATUS:installer:STATUS:
Installer: STATUS:installer:%100.000000
Installer: STATUS:installer:PHASE:The software was successfully installed.
Installer: STATUS:installer: The upgrade was successful.
Installer: STATUS:OK:DONE
Installer: Disconnecting
Traceback (most recent call last):
  File "/Library/AutoPkg/autopkglib/__init__.py", line 673, in process
    self.env = processor.process()
  File "/Library/AutoPkg/autopkglib/__init__.py", line 480, in process
    self.main()
  File "/Library/AutoPkg/autopkglib/Installer.py", line 181, in main
    self.install()
  File "/Library/AutoPkg/autopkglib/Installer.py", line 127, in install
    self.disconnect()
  File "/Library/AutoPkg/autopkglib/Installer.py", line 177, in disconnect
    self.socket.close()
  File "/Library/AutoPkg/Python3/Python.framework/Versions/Current/lib/python3.7/socket.py", line 420, in close
    self._real_close()
  File "/Library/AutoPkg/Python3/Python.framework/Versions/Current/lib/python3.7/socket.py", line 414, in _real_close
    _ss.close(self)
OSError: [Errno 9] Bad file descriptor
  File "/Library/AutoPkg/autopkglib/__init__.py", line 673, in process
    self.env = processor.process()
[Errno 9] Bad file descriptor
Failed.
Receipt written to /Users/jgstew/Library/AutoPkg/Cache/com.github.hansen-m.install.BESPythonAPI/receipts/BESPythonAPI-receipt-20200512-112348.plist

The following recipes failed:
    BESPythonAPI.install
        Error in com.github.hansen-m.install.BESPythonAPI: Processor: Installer: Error: [Errno 9] Bad file descriptor

The following new items were downloaded:
    Download Path                                                                                               
    -------------                                                                                               
    /Users/jgstew/Library/AutoPkg/Cache/com.github.hansen-m.install.BESPythonAPI/downloads/BESEngine.zip  

The following packages were built:
    Identifier                Version  Pkg Path                                                                                              
    ----------                -------  --------                                                                                              
    edu.psu.pkg.BESPythonAPI  2.0      /Users/jgstew/Library/AutoPkg/Cache/com.github.hansen-m.install.BESPythonAPI/BESEngine-2.0.pkg 
jgstew commented 4 years ago

I did end up manually running the PKG file that is generated, so I think the BESAPI stuff is now in place, BUT, i still get this error when running the recipe.

Also, I ended up deleting some of the BES Processors because autopkg was not functional, complaining of lack of besapi before I resolved this, but I think now I'm still missing those BES Processors I deleted. I guess I need to undelete them from trash? they didn't come back on their own.

rustymyers commented 4 years ago

Which version of autopkg? I'll have to take a closer look and try to reproduce.

jgstew commented 4 years ago

Autopkg 2.0.2

jgstew commented 4 years ago

Related: https://stackoverflow.com/questions/7686275/what-can-lead-to-ioerror-errno-9-bad-file-descriptor-during-os-system

jgstew commented 4 years ago

it sounds like the code is calling the socket to close, but the socket is already closed, so it is throwing an error. I looked into the code in autopkglib in a few places. I can't seem to find the issue, but it could be that the fix is just to catch this error and make it a pass instead of a "failure".

rustymyers commented 4 years ago

Interestingly, the PkgCreator recipe also has the issue: PkgCreator: Failed to close socket: [Errno 9] Bad file descriptor

rustymyers commented 4 years ago

I've tried this with a stock install of AutoPkg 2.0.2 and adding the https://github.com/autopkg/rtrouton-recipes repo, then running the RStudio.pkg recipe. It continues to close the socket, so I believe this is an issue with AutoPkg code and not the BESPythonAPI install. It looks like the package installed successfully, as intended, but does have the error when trying to close the socket regardless.

Closing for now...

jgstew commented 4 years ago

yeah, this is a weird one. Seems like a double close problem, or a close after closed problem.

I wonder how long this has been an issue? Or when it started?

Seems like AutoPkg itself either needs to somehow stop this from happening, or detect it is already closed and not try to close it again, or put it in a try/catch block and pass this specific error.

I was trying to figure out the right way to try/catch this error specifically, which could be done in the Processor itself OR inside of AutoPkg.

rustymyers commented 4 years ago

It's come up in the past: https://github.com/autopkg/autopkg/issues?q=is%3Aissue+socket

jgstew commented 4 years ago

yeah, I just went digging and found it here: https://github.com/autopkg/autopkg/issues/615

looks like this fix was right after autopkg 2.0.2 was released