venf2k / google-cloud-sdk

Automatically exported from code.google.com/p/google-cloud-sdk
0 stars 0 forks source link

Python Errors in Managed VM Shutdown Script ("/usr/share/vm_runtime/vm_logging.py", line 15) #707

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
- Create a Python Flexible App Engine project (formally Managed VM)
- Put an old copy of the python library oauth2client on your project path. 
Specifically, this version must be older than Jan. 5, 2016. This older version 
did not have a subfolder named "contrib". As you will see, this older version 
causes a conflict with the Managed VM shutdown script.
- Deploy the app.
- Allow the app to scale up and then scale down again.

What is the expected output? What do you see instead?
I expect the managed vm instance to shutdown normally. Instead, when the 
managed VM instance is shutdown, there is an exception raised in the shutdown 
script:
    Apr 5 13:57:15 gae-vm-20160331t003605-kbvx shutdownscript: ImportError: No module named contrib
    09:57:15.000
    Apr 5 13:57:15 gae-vm-20160331t003605-kbvx shutdownscript: from oauth2client.contrib import gce
    09:57:15.000
    Apr 5 13:57:15 gae-vm-20160331t003605-kbvx shutdownscript: File "/usr/share/vm_runtime/vm_logging.py", line 15, in
    09:57:15.000
    Apr 5 13:57:15 gae-vm-20160331t003605-kbvx shutdownscript: Traceback (most recent call last):
    09:57:15.000
    Apr 5 13:57:15 gae-vm-20160331t003605-kbvx shutdownscript: Running shutdown script /var/run/google.shutdown.script

The problem here is that the shutdown script is trying to import oauth2client, 
which is on the user's path, and which conflicts with the version the shutdown 
script is expecting. I have attached an image of this error, and a screenshot 
showing a thread being terminated without warning.

There are two issues here:
1. The shutdown script should not be importing files from the user's project 
path (should it?). This seems dangerous, especially if there are conflicting 
versions, as is the case here. It can cause the shutdown scripts to fail.
2. When there is an exception in the shutdown script, the entire instance goes 
down without waiting for threads to complete. This can put the entire system 
into a bad state.

What is the output of 'gcloud info'?
-----------
    Google Cloud SDK [100.0.0]

    Platform: [Windows, x86_64]
    Python Version: [2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]]
    Python Location: [c:\Python27\python.exe]
    Site Packages: [Disabled]

    Installation Root: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk]
    Installed Components:
      core: [2016.03.04]
      app-engine-python: [1.9.33]
      bq-win: [2.0.18]
      core-win: [2016.02.05]
      gcloud: []
      windows-ssh-tools: [2016.02.22]
      beta: [2016.01.12]
      gsutil: [4.17]
      bq: [2.0.18]
      gsutil-win: [4.16]
    System PATH: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin\..\bin\sdk;C:\Program Files\ImageMagick-6.9.3-Q16-HDRI;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Ethereum 0.9.41\bin;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Tesseract-OCR;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files (x86)\Mercurial\;c:\Python27;C:\Python27\Scripts;C:\cygwin\bin;C:\Users\Michael\AppData\Local\Programs\Git\cmd;C:\Program Files (x86)\qpdf-5.1.2\bin]
    Cloud SDK on PATH: [True]

    Installation Properties: [C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\properties]
    User Config Directory: [C:\Users\Michael\AppData\Roaming\gcloud]
    User Properties: [C:\Users\Michael\AppData\Roaming\gcloud\properties]

    Account: [REDACTED, ASK FOR INFO]
    Project: [REDACTED, ASK FOR INFO]

    Current Properties:
      [core]
        project: [REDACTED, ASK FOR INFO]
        account: [REDACTED, ASK FOR INFO]
        disable_usage_reporting: [False]
      [app]
        promote_by_default: [False]
        use_cloud_build: [True]
        suppress_change_warning: [true]
      [compute]
        region: [us-central1]
        zone: [us-central1-f]

    Logs Directory: [C:\Users\Michael\AppData\Roaming\gcloud\logs]
    Last Log File: [C:\Users\Michael\AppData\Roaming\gcloud\logs\2016.04.05\23.53.31.590000.log]
-----------

Original issue reported on code.google.com by michael....@gmail.com on 6 Apr 2016 at 4:06

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks for reporting this issue! I'll pass this information along to the 
Managed VMs team.

Original comment by z...@google.com on 6 Apr 2016 at 5:23