error: swift cache could not be found in env!

Asked by Nick Fytros on 2013-12-29

After installing everything under the instructions at openstack swift in my VM everything was going good until i typed the following 2 commands as the instructions said at http://docs.openstack.org/developer/swift/development_saio.html#partition-section
The first was : curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0 witch went good and the second: curl -v -H 'X-Auth-Token: <token-from-x-auth-token-above>' <url-from-x-storage-url-above>
and then i got 503 internal server error and at the syslog i got the error: proxyserver STDOUT: Error:root:Error: swift.cache could not be found in env! (txn: tx85b3cb5152984fa0b211e-0052c00503) (client_ip: 127.0.0.1)
Any ideas why is this happening?

Thanks

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Mehmet Hacısalihoğlu
Solved:
2014-01-06
Last query:
2014-01-06
Last reply:
2014-01-02

This question was reopened

Hi,

Could you share proxy-server conf and memcached.conf?

Hi,

You can add "memcache_servers = 192.168.56130:11211" in [filter:cache] of your proxy-server.conf file.

proxy-server.conf
[filter:cache]
use = egg:swift#memcache
memcache_servers = Proxy_server_ip:11211

#proxy_server_ip example 192.168.56.135

memcached.conf
-l proxy_server_ip # -l 127.0.0.1 change proxy_server_ip

after you must restart to proxy and memcached service.

Nick Fytros (fitros16) said : #4

where can i find my proxy server ip address? should i set it with bind_ip?
Thanks

Nick Fytros (fitros16) said : #5

After doing what you said and trying to start proxy server with the command:
swift-proxy-server /etc/swift/proxy-server.conf it throws an exception:
Could not bind to 0.0.0.0:8080 aster trying for 30 seconds.

proxy server ip that your virtual machine ip located on the proxy server.

Nick Fytros (fitros16) said : #8

After following the instructions you gave me the same error still pops up in syslog and i get 503 server internal error. Any more ideas?
Thanks

Nick Fytros (fitros16) said : #9

Thanks Mehmet Hacısalihoğlu, that solved my question.

Will Stevens (cloudops) said : #10

Can you please post the final config you used. I am also stuck on this problem and I have tried everything I can think of to get the memcached server and proxy-server to play nice together.

Thanks...

Nick Fytros (fitros16) said : #11

Hi,
Well this problem still happens on my syslog but now i dont have any problems.
The thing that was going wrong with mine server is that when i used startmain to start all the servers the output i got was that all started but they didnt.
I started them manually.
I used:
service swift-proxy restart (or start)
service swift-account restart
service swift-container restart
service swift-object restart

The memcached error is still there.. nothing worked that could remove it.

Will Stevens (cloudops) said : #12

Ok thank you...

I am able to get tempauth to work, but I am not sure if that means that memcached is working because I get these two errors in my proxy.error file all the time:

Jan 9 16:45:13 willswift proxy-server: STDOUT: ERROR:root:ERROR: swift.cache could not be found in env! (txn: txc75a7ce83d454b479b8c3-0052cf1869)
Jan 9 16:45:13 willswift proxy-server: Warning: Cannot ratelimit without a memcached client (txn: txc75a7ce83d454b479b8c3-0052cf1869)

I also have another error, but it might be associated with the auth middleware I wrote. Unfortunately I am not able to see the real error because of the MAXLINES truncation of syslog. :(

memcache_client.set('mauth_creds/%s/%s' % (auth_user, auth_key), (expires, identity), time=env.get('HTTP_X_AUTH_TTL', self.cache_timeout))#012UnboundLocalError: lo

I will see what I can figure out... Thanks for posting back...

Nick Fytros (fitros16) said : #13

I can't help on these cause i am not at the dev team hehe :)
No problems, i hope you can figure it out shortly.

Samuel Merritt (torgomatic) said : #14

Also, don't forget to make sure "cache" occurs in your pipeline *before* tempauth, like so:

pipeline = catch_errors proxy-logging cache ...others... tempauth proxy-logging proxy-server

Will Stevens (cloudops) said : #15

Yes, I have cache in the pipeline before the auth middlewares.

I have fixed an issue with my auth middleware, so my 'UnboundLocalError' has been fixed.

I am still getting the following two errors in the proxy.error log, but everything is working:
Jan 10 15:17:34 willswift proxy-server: STDOUT: ERROR:root:ERROR: swift.cache could not be found in env! (txn: tx2d94b78541344672bab6d-0052d0555e)
Jan 10 15:17:34 willswift proxy-server: Warning: Cannot ratelimit without a memcached client (txn: tx2d94b78541344672bab6d-0052d0555e)

I have verified that memcache is actually working because my auth system in successfully saving and pulling identities from the 'memcache_client' (as defined here: "memcache_client = cache_from_env(env)"). So everything is working, but the errors are still being reported.

I am on Swift 1.11. A co-worker has Swift 1.13 installed and running in dev and he is not seeing these errors, so maybe this issue has been found and solved already.

Thanks for following up. This is not blocking me...

Samuel Merritt (torgomatic) said : #16

Those warnings are coming from the ratelimit middleware; it also has to come after cache in the pipeline. Ratelimit won't break the proxy in this case, but it also won't do any limiting.

Will Stevens (cloudops) said : #17

Nice catch. I moved 'ratelimit' after cache in the pipeline and I no longer have any errors.

Thank you for following up to clarify that...