i have web app that i have developed using bottle micro framework.
However it crash a lot and all of them suddenly without any action ( without using the web app) . So i have reviewed the logs file and find the following errors (i have no idea what the causation of these errors):
Traceback (most recent call last):
File "/home/hamoud/lib/python2.7/bottle.py", line 2699, in run
server.run(app)
File "/home/hamoud/lib/python2.7/bottle.py", line 2385, in run
srv = make_server(self.host, self.port, handler, **self.options)
File "/usr/local/lib/python2.7/wsgiref/simple_server.py", line 144, in make_server
server = server_class((host, port), handler_class)
File "/usr/local/lib/python2.7/SocketServer.py", line 419, in __init__
self.server_bind()
File "/usr/local/lib/python2.7/wsgiref/simple_server.py", line 48, in server_bind
HTTPServer.server_bind(self)
File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/local/lib/python2.7/SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "/usr/local/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
TypeError: 'int' object is not callable
and
Traceback (most recent call last):
File "interface.py", line 29, in <module>
run(host="localhost", port=32471, reloader=True, debug=True)
File "/home/hamoud/lib/python2.7/bottle.py", line 2657, in run
os.utime(lockfile, None) # I am alive!
OSError: [Errno 2] No such file or directory: '/tmp/bottle.gQmJc8.lock'
However the second error doesn't crash the application ( application would continue working ) but for the first one it's require manual work ( run the app again ).
i could schedule task using cron job to run the application when it's crash. but i'd like to know what's the problem in my app.
A few ideas come to mind:
Could there be another program on your machine (e.g., a cron job) that is deleting files from /tmp?
Are you using the latest version of Bottle? (From the line number in your stacktrace, it looks like you might not be.)
If nothing else works, try running without reloader=True (or use reloader=False). I looked at the Bottle code, and that change should at least work around the problem, even though we don't know the cause (yet).
Hope that helps.
Related
I'm trying to use SAM Accelerate as recommended by AWS. However, the sam sync command is failing
PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: jsonpickle==2.1.0
The requirement for jsonpickle is included in the requirements.txt file, and it's installed locally.
foo#bar:~/sam-project$ pip freeze | grep jsonpickle
jsonpickle==2.1.0
The exact same error occurs when I use sam build, but I'm able to use the sam build -u to use a container and make the build work. Unfortunately that doesn't seem to be an option for sam sync.
I have found a few occurrences of a similar issue, but none of them address the root cause and this I am unsure of how to fix this.
Full output
foo#bar:~/sam-project$ sam sync --watch
The SAM CLI will use the AWS Lambda, Amazon API Gateway, and AWS StepFunctions APIs to upload your code without
performing a CloudFormation deployment. This will cause drift in your CloudFormation stack.
**The sync command should only be used against a development stack**.
Confirm that you are synchronizing a development stack.
Enter Y to proceed with the command, or enter N to cancel:
[Y/n]: y
Queued infra sync. Wating for in progress code syncs to complete...
Starting infra sync.
Manifest file is changed (new hash: 1719a58de4024a0928ae0e3ddf42ac82) or dependency folder (.aws-sam/deps/ce2e5caa-e309-401a-8ab1-425d3c3e399d) is missing for (CoreLayer), downloading dependencies and copying/building source
Building layer 'CoreLayer'
Running PythonPipBuilder:CleanUp
Clean up action: .aws-sam/deps/ce2e5caa-e309-401a-8ab1-425d3c3e399d does not exist and will be skipped.
Running PythonPipBuilder:ResolveDependencies
Build Failed
Failed to sync infra. Code sync is paused until template/stack is fixed.
Traceback (most recent call last):
File "aws_lambda_builders/workflows/python_pip/actions.py", line 54, in execute
File "aws_lambda_builders/workflows/python_pip/packager.py", line 156, in build_dependencies
File "aws_lambda_builders/workflows/python_pip/packager.py", line 258, in build_site_packages
File "aws_lambda_builders/workflows/python_pip/packager.py", line 282, in _download_dependencies
File "aws_lambda_builders/workflows/python_pip/packager.py", line 365, in _download_all_dependencies
File "aws_lambda_builders/workflows/python_pip/packager.py", line 717, in download_all_dependencies
aws_lambda_builders.workflows.python_pip.packager.NoSuchPackageError: Could not satisfy the requirement: jsonpickle==2.1.0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "aws_lambda_builders/workflow.py", line 301, in run
File "aws_lambda_builders/workflows/python_pip/actions.py", line 57, in execute
aws_lambda_builders.actions.ActionFailedError: Could not satisfy the requirement: jsonpickle==2.1.0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "samcli/lib/build/app_builder.py", line 760, in _build_function_in_process
File "aws_lambda_builders/builder.py", line 164, in build
File "aws_lambda_builders/workflow.py", line 95, in wrapper
File "aws_lambda_builders/workflow.py", line 308, in run
aws_lambda_builders.exceptions.WorkflowFailedError: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: jsonpickle==2.1.0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "samcli/commands/build/build_context.py", line 248, in run
File "samcli/lib/build/app_builder.py", line 221, in build
File "samcli/lib/build/build_strategy.py", line 358, in build
File "samcli/lib/build/build_strategy.py", line 78, in build
File "samcli/lib/build/build_strategy.py", line 361, in _build_layers
File "samcli/lib/build/build_strategy.py", line 380, in _run_builds_async
File "samcli/lib/utils/async_utils.py", line 131, in run_async
File "samcli/lib/utils/async_utils.py", line 90, in run_given_tasks_async
File "asyncio/base_events.py", line 587, in run_until_complete
File "samcli/lib/utils/async_utils.py", line 58, in _run_given_tasks_async
File "concurrent/futures/thread.py", line 57, in run
File "samcli/lib/build/build_strategy.py", line 388, in build_single_layer_definition
File "samcli/lib/build/build_strategy.py", line 546, in build_single_layer_definition
File "samcli/lib/build/build_strategy.py", line 430, in build_single_layer_definition
File "samcli/lib/build/build_strategy.py", line 218, in build_single_layer_definition
File "samcli/lib/build/app_builder.py", line 552, in _build_layer
File "samcli/lib/build/app_builder.py", line 763, in _build_function_in_process
samcli.lib.build.exceptions.BuildError: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: jsonpickle==2.1.0
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "samcli/lib/sync/watch_manager.py", line 190, in _execute_infra_sync
File "samcli/lib/sync/watch_manager.py", line 142, in _execute_infra_context
File "samcli/commands/build/build_context.py", line 308, in run
samcli.commands.exceptions.UserException: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: jsonpickle==2.1.0
samcli.commands.exceptions.UserException: PythonPipBuilder:ResolveDependencies - Could not satisfy the requirement: jsonpickle==2.1.0
Unfortunately no one was able to assist here, so I opened an issue on GitHub.
Eventually the issue became clear and it's not actually an issue with SAM. The problem is that I use an AWS BuildArtifact feed, so any sam build or sam sync action will try and pull packages from that feed. However, the token for that feed expires after 12 hours.
The issue remains open and the SAM team are investigating the error that is displayed, and hopefully they will implement a solution that will surface the underlying error message, which would have made diagnosing this issue a whole lot easier.
When executing the following command in the mac terminal I got an error: aws configure
I couldn't really find anything helpful online and I am newbie to mac and to aws. Can somebody please help me fix it?
same thing would happen with other commands like aws --version
commands like which awswould work normally
Traceback (most recent call last):
File "botocore/configloader.py", line 149, in raw_config_parse
File "configparser.py", line 696, in read
File "configparser.py", line 1091, in _read
configparser.DuplicateOptionError: While reading from '/Users/sj-auteon/.aws/credentials' [line 4]: option 'aws_access_key_id' in section 'default' already exists
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "aws", line 27, in <module>
File "aws", line 23, in main
File "awscli/clidriver.py", line 90, in main
File "awscli/clidriver.py", line 99, in create_clidriver
File "botocore/session.py", line 361, in full_config
File "botocore/configloader.py", line 152, in raw_config_parse
botocore.exceptions.ConfigParseError: Unable to parse config file: /Users/sj-auteon/.aws/credentials
[831] Failed to execute script aws```
Based on the comments. The solution was to delete existing .aws/credentials and create new one using aws configure command.
I'm trying to get a Google app up and running on my local machine, however, am facing an issue when running the setup scripts. The script errors out and tells me that there is no module time and seems to be breaking in the google-cloud-sdk....
Things I've tried:
Importing time in Python (it works)
Trying this to no avail: https://apple.stackexchange.com/questions/96308/python-installation-messed-up
Traceback (most recent call last):
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/_python_runtime.py", line 83, in <module>
_run_file(__file__, globals())
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/_python_runtime.py", line 79, in _run_file
execfile(_PATHS.script_file(script_name), globals_)
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime.py", line 175, in <module>
main()
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/runtime.py", line 155, in main
sandbox.enable_sandbox(config)
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 183, in enable_sandbox
__import__('%s.threading' % dist27.__name__)
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/google/appengine/dist27/threading.py", line 13, in <module>
from time import time as _time, sleep as _sleep
File "/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 984, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named time
Here is my current $PATH:
/Users/kennethryan/Projects/go-edu-store/y/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Seeing as this is an inactive year old issue, we can assume that updating the Google Cloud tools to their latest versions by running 'gcloud components update' will fix this.
Also ensuring that you are using the Python installation provided by GCloud, and that there are no conflicting 'CLOUDSDK_PYTHON' environment variables should prevent this.
If this issue is seen again in the future, it is recommended to directly report this to the Google Public Issue Tracker so that this can be properly handled and triaged to the GCloud engineering team.
In my case, I resolved this problem by setting
export PYTHONPATH=$PYTHONPATH:/usr/lib64/python2.7/lib-dynload/ where timemodule.so file is located.
I'm planing to run a django project on google cloud plateform (GAE, Cloud SQL). The project uses several django reusable apps (libraries) like South, django-debug-toolbar, django-compressor, etc. So, i'm wondering if there is a way to manage all these libraries on appengine? if Yes, how.
PS: I've tried to define dependencies in the app.yaml file, but i'm getting errors:
Traceback (most recent call last):
File "/usr/local/bin/dev_appserver.py", line 197, in <module>
_run_file(__file__, globals())
File "/usr/local/bin/dev_appserver.py", line 193, in _run_file
execfile(script_path, globals_)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 855, in <module>
main()
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 848, in main
dev_server.start(options)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 657, in start
options.yaml_files)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
module_configuration = ModuleConfiguration(yaml_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
self._yaml_path)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 272, in _parse_configuration
return appinfo_includes.ParseAndReturnIncludePaths(f)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/appinfo_includes.py", line 63, in ParseAndReturnIncludePaths
appyaml = appinfo.LoadSingleAppInfo(appinfo_file)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/appinfo.py", line 1743, in LoadSingleAppInfo
listener.Parse(app_info)
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/yaml_listener.py", line 226, in Parse
self._HandleEvents(self._GenerateEventParameters(stream, loader_class))
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/yaml_listener.py", line 177, in _HandleEvents
raise yaml_errors.EventError(e, event_object)
google.appengine.api.yaml_errors.EventError: the library "django-appconf" is not supported
in "jobbr/app.yaml", line 13, column 1
Sorry, but at least South and django-compressor would not run on GAE.
GAE is a completely different platform. Yet you have SQL access to your tables, it's just an abstraction layer over a nonrelative database. There is no filesystem access, but there are tons of other limitations. Even Django itself could not be run on GAE without patches - you have to use special version, django-nonrel.
I would suggest to read more GAE documentation so you can decide if a particular application could be run there or not.
I am running django on django's development server. It was working fine before but from yesterday i keep getting this error on the linux command line where server was running.
Exception happened during processing of request from ('57.xx.xx.123', 63721)
Traceback (most recent call last):
File "/opt/python27/lib/python2.7/SocketServer.py", line 284, in _handle_reque st_noblock
self.process_request(request, client_address)
File "/opt/python27/lib/python2.7/SocketServer.py", line 310, in process_reque st
self.finish_request(request, client_address)
File "/opt/python27/lib/python2.7/SocketServer.py", line 323, in finish_reques t
self.RequestHandlerClass(request, client_address, self)
File "/opt/python27/lib/python2.7/site-packages/django/core/servers/basehttp.p y", line 570, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/opt/python27/lib/python2.7/SocketServer.py", line 641, in __init__
self.finish()
File "/opt/python27/lib/python2.7/SocketServer.py", line 694, in finish
self.wfile.flush()
File "/opt/python27/lib/python2.7/socket.py", line 301, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
can anyone guide me that why it started happening now
This happen only 1 out of 10 times
"Broken pipe" means that there was still outgoing data on a file descriptor (a socket, in this case) when the destination closed down.
In this case, the most likely cause is the browser closing the connection before the Django development server has sent the entire response.
Occasionally I'll see a broken pipe after an exception, or when connecting to my Linux box form Windows when doing cross-browser/platform testing. I'm not exactly sure what causes these errors, but restarting Django's development server is all I know to do to fix it.