Azure Blob: "The condition specified using HTTP conditional header(s) is not met" -
i got exception when run application. happens in real azure blob storage.
i've caught fiddler request creates problem:
get http://127.0.0.1:10000/devstoreaccount1/ebb413ed-fdb5-49f2-a5ac-74faa7e2d3bf/8844c3ec-9e4b-43ec-88b2-58eddf65fc0a/perro?timeout=90 http/1.1 x-ms-version: 2009-09-19 user-agent: wa-storage/6.0.6002.18006 x-ms-range: bytes=0-524304 if-match: 0x8cda190bd304dd0 x-ms-date: wed, 23 feb 2011 16:49:18 gmt authorization: sharedkey devstoreaccount1:5j3iscy9ujln3o1icwkwveazo4/idjg796sdzkqhlr4= host: 127.0.0.1:10000
and response:
http/1.1 412 condition specified using http conditional header(s) not met. content-length: 252 content-type: application/xml server: windows-azure-blob/1.0 microsoft-httpapi/2.0 x-ms-request-id: fbff9d15-65c8-4f21-9088-c95e4496c62c x-ms-version: 2009-09-19 date: wed, 23 feb 2011 16:49:18 gmt <?xml version="1.0" encoding="utf-8"?><error><code>conditionnotmet</code><message>the condition specified using http conditional header(s) not met. requestid:fbff9d15-65c8-4f21-9088-c95e4496c62c time:2011-02-23t16:49:18.8790478z</message></error>
it happens when use stream retrieved line:
blob.openread();
why etag minds in read operation? how may avoid problem?
it happens every time launch several parallel tasks doing things on blob storage.
if use:
blob.openread(new blobrequestoptions() { accesscondition = accesscondition.ifmatch("*") });
i got exception no inner 1 (before had webexception details), either fail line in fiddler :
microsoft.windowsazure.storageclient.storageclientexception unhandled message=the conditionals specified operation did not match server. source=mscorlib stacktrace: server stack trace: @ microsoft.windowsazure.storageclient.tasks.task`1.get_result() @ microsoft.windowsazure.storageclient.tasks.task`1.executeandwait() @ microsoft.windowsazure.storageclient.taskimplhelper.executeimpl[t](func`2 impl) @ microsoft.windowsazure.storageclient.blobreadstream.read(byte[] buffer, int32 offset, int32 count) @ system.io.binaryreader.readbytes(int32 count) @ system.runtime.serialization.formatters.binary.serializationheaderrecord.read(__binaryparser input) @ system.runtime.serialization.formatters.binary.__binaryparser.readserializationheaderrecord() @ system.runtime.serialization.formatters.binary.__binaryparser.run() @ system.runtime.serialization.formatters.binary.objectreader.deserialize(headerhandler handler, __binaryparser serparser, boolean fcheck, boolean iscrossappdomain, imethodcallmessage methodcallmessage) @ system.runtime.serialization.formatters.binary.binaryformatter.deserialize(stream serializationstream, headerhandler handler, boolean fcheck, boolean iscrossappdomain, imethodcallmessage methodcallmessage) ...........
thanks in advance.
bufff... mistery solved!
well, when cloudblob.openread()
, client library doing 2 operations:
first, blob block list:
get /devstoreaccount1/etagtest/test2.txt?comp=blocklist&blocklisttype=committed&timeout=90 http/1.1 x-ms-version: 2009-09-19 user-agent: wa-storage/6.0.6002.18006 x-ms-date: wed, 23 feb 2011 22:21:01 gmt authorization: sharedkey devstoreaccount1:spobe/iurzjvopxnadd/twnppvu37+qrubhnabhjy24= host: 127.0.0.1:10000 http/1.1 200 ok transfer-encoding: chunked content-type: application/xml last-modified: wed, 23 feb 2011 22:20:33 gmt etag: 0x8cda1bf0593b660 server: windows-azure-blob/1.0 microsoft-httpapi/2.0 x-ms-request-id: ecffddf2-137f-403c-9595-c8fc2847c9d0 x-ms-version: 2009-09-19 x-ms-blob-content-length: 4 date: wed, 23 feb 2011 22:21:02 gmt
attention etag in response.
second, guess start retrieve it, , attention etag in request:
get /devstoreaccount1/etagtest/test2.txt?timeout=90 http/1.1 x-ms-version: 2009-09-19 user-agent: wa-storage/6.0.6002.18006 x-ms-range: bytes=0-525311 if-match: 0x8cda1bf0593b660 x-ms-date: wed, 23 feb 2011 22:21:02 gmt authorization: sharedkey devstoreaccount1:wxzxrv5e9+p0szlhuad7iv7jrhxvf+27t9to4nrhy5q= host: 127.0.0.1:10000 http/1.1 206 partial content content-length: 4 content-type: text/plain content-range: bytes 0-3/4 last-modified: wed, 23 feb 2011 22:20:33 gmt etag: 0x8cda1bf0593b660 server: windows-azure-blob/1.0 microsoft-httpapi/2.0 x-ms-request-id: db1e221d-fc61-4837-a255-28b1547cb5d7 x-ms-version: 2009-09-19 x-ms-lease-status: unlocked x-ms-blob-type: blockblob date: wed, 23 feb 2011 22:21:02 gmt
what happen if webrole in blob between call? yes race condition.
solution: use cloudblob.downloadtostream()
, method issues 1 call:
get /devstoreaccount1/etagtestxx/test2.txt?timeout=90 http/1.1 x-ms-version: 2009-09-19 user-agent: wa-storage/6.0.6002.18006 x-ms-date: wed, 23 feb 2011 22:34:02 gmt authorization: sharedkey devstoreaccount1:vjxio2kbjcip4ueixptxdxmfleoyakoqirv4sv3bzno= host: 127.0.0.1:10000 http/1.1 200 ok content-length: 4 content-type: text/plain last-modified: wed, 23 feb 2011 22:33:47 gmt etag: 0x8cda1c0deb562d0 server: windows-azure-blob/1.0 microsoft-httpapi/2.0 x-ms-request-id: 183a05bb-ea47-4811-8768-6a62195cdb64 x-ms-version: 2009-09-19 x-ms-lease-status: unlocked x-ms-blob-type: blockblob date: wed, 23 feb 2011 22:34:02 gmt
i put on practice tomorrow morning @ work , see happen.
Comments
Post a Comment