tracker issue : CF-3226380

select a category, or use search below
(searches all categories and all time range)
Title:

StoreGetMetadata - Amazon S3 Metadata Caching Problem / Requires Restart (CF 9.0.1 and CF10)

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): JJ BLODGETT / JJ BLODGETT (jj blodgett)

Created: 06/28/2012

Components: File Management, VFS-S3

Versions: 9.0.1

Failure Type:

Found In Build/Fixed In Build: 9.0.1 / CF11 Update5,CF10 Update16

Priority/Frequency: Major / Most users will encounter

Locale/System: English / Win 2003 Server x64

Vote Count: 2

Listed in the version 11.0.05.293506 Issues Fixed doc
Problem Description:

It appears that ColdFusion is caching Amazon S3 Metadata on the Server / Instance.  Once you retrieve an object's Metadata on a Server / Instance, changes or additions to that Metadata from other Servers, Instances, 3rd Party Apps, or Amazon S3 Console can't be retrieved on that same Server  / Instance until the CF Service is restarted.

This means that if you get the Metadata from ObjectX using StoreGetMetadata, and then you add an additional key from any other source (server, instance, S3 console, etc), a subsequent call to StoreGetMetadata for ObjectX will not reflect the additions or changes.

In addition, StoreGetMetadata doesn't return the exact S3 Metadata key names even on the same server that used StoreSetMetadata to add/update the Metadata in the first place.

It appears that whatever cache mechanism being used does not refresh or even have an option to refresh the cache information on a given instance.  We have confirmed that the Metadata remains static overnight (at least 18-19 hours) and the only way we've found to get the correct values from Amazon is to restart the CF service.  This is obviously not practical or possible every time Metadata is updated.

It appears that even if you update Metadata from an instance of CF, there is still some "cache" version of the object being referenced locally because the cfdump of the Metadata struct would reflect keys with different upper/lower cases if the struct key was created in all caps.

This would affect anyone that was accessing Amazon S3 metadata from multiple sources include multiple instances of CF, multiple CF Servers, the Amazon S3 Console, or 3rd Party Apps such as BucketExplorer, etc.

Steps to Reproduce:

STEP 1:

CF_INSTANCE_A:
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

CF_INSTANCE_B:
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

CF_INSTANCE_C:
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

RESULT: All 3 instances should return the same values

STEP 2:

CF_INSTANCE_A:
<cfset structNewMeta = StructNew()>
<cfset structNewMeta ["varTest"] = "value">
<cfset StoreSetMetadata("s3://BUCKET/OBJECT", structMeta1)>

<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

CF_INSTANCE_B:
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

CF_INSTANCE_C:
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

RESULT: CF_INSTANCE_A will see the original Metadata AND a new key called "VARTEST" (all uppercase). CF_INSTANCE_B and CF_INSTANCE_C do not see the new key at all.  You can look at the object directly in the Amazon S3 Console to confirm the key "x-amz-meta-vartest" was added successfully.  But note that the key name is actually lowercase and not uppercase as CF_INSTANCE_A is reporting.

STEP 3:

CF_INSTANCE_B:
[[Restart CF Instance]]
<cfset structContent = StoreGetMetadata("s3://BUCKET/OBJECT")>
<cfdump var="#str#">

RESULT: CF_INSTANCE_A will see the original Metadata AND the key called "VARTEST" (all uppercase). CF_INSTANCE_B will see the original Metadata AND the key called "vartest" (all lowercase). CF_INSTANCE_C does not see the new key at all.

STEP 4:

AMAZON S3 CONSOLE:
Change value of "vartest" to "new value"

RESULT: CF_INSTANCE_A and CF_INSTANCE_B will still see their respective VARTEST/vartest keys but the value will contain "value" and will not reflect the "new value" that is the actual value at Amazon.

Workaround:

Only workaround we have found so far is to restart the CF service which is not practical in any environment.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3226380

External Customer Info:
External Company:  
External Customer Name: jjblodg
External Customer Email:  
External Test Config: Initially found on CF 9.0.1 Enterprise running as Multiple Instances on the same machine.  Confirmed the behavior on a CF10 single server install at a completely different company/server accessing the exact same object we referenced on the CF 9.0.1 instances.

Attachments:

Comments:

I helped JJ identify this, and would agree that having to restart CF is not the right way to clear this cached info. :-) If there's some intended benefit to the caching (which I could understand), then there ought to be a means to flush that cached info, just as we have for flushing cached web service metadata. Whether that's done as a new argument on the storegetmetadata, or a new function, something else seems needed. I'd argue against a second argument, because that's like the refreshwsdl attribute added to CFINVOKE. While those approaches are "easier" for developers, they're risky because a developer could leave them in and now each call would be doing that refresh.
Vote by External U.
18844 | June 29, 2012 12:10:33 PM GMT
Verified on build no:11.0.03.292643 Platform tested: Windows 7 64bit testcase location://depot/qa/cf/regression/newmanual/coldfusion/tags/filemanagement/AmazonS3Support/
Comment by Suchika S.
18841 | December 22, 2014 05:56:15 AM GMT
+1 ......................
Vote by External U.
18845 | January 05, 2015 02:30:32 AM GMT
The fix for this bug is available in the pre-release build of ColdFusion 11 Update 5 and ColdFusion 10 Update 16
Comment by CFwatson U.
18842 | February 20, 2015 09:25:01 AM GMT
Verified this is fixed in CF11 Update 5 (build 11,0,05,293506). Also, the additional metadata keys are consistently dumped as lowercase (good). Thanks!, -Aaron
Comment by External U.
18843 | November 17, 2015 03:00:32 AM GMT