hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Clinton Nielsen (Issue Comment Edited) (JIRA)" <j...@apache.org>
Subject [jira] [Issue Comment Edited] (HTTPCLIENT-1153) org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage uses URL as cache key - shouldn't.
Date Tue, 17 Jan 2012 17:44:39 GMT

    [ https://issues.apache.org/jira/browse/HTTPCLIENT-1153?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13187826#comment-13187826
] 

Clinton Nielsen edited comment on HTTPCLIENT-1153 at 1/17/12 5:43 PM:
----------------------------------------------------------------------

@Jon: Yeah, I took a brief look through the code and it looks good.

One suggestion I have is that java.security.MessageDigest, as I understand it, is not threadsafe.
So if multiple threads are trying to use MemcachedHttpCacheStorage (and even if they all have
their own instance of the same), the MessageDigest class will always be using the same underlying
instance and therefore one thread might stomp another while trying to generate a hash.

Consider cloning the MessageDigest instance or synchronizing the creation of the hash.

Thanks.

                
      was (Author: tinclon):
    @Jon: Yeah, I took a brief look through the code and it looks good.

One suggestion I have is that java.security.MessageDigest, as I understand it, it not threadsafe.
So if multiple threads are trying to use MemcachedHttpCacheStorage (and even if they all have
their own instance of the same), the MessageDigest class will always be using the same underlying
instance and therefore one thread might stomp another while trying to generate a hash.

Consider cloning the MessageDigest instance or synchronizing the creation of the hash.

Thanks.

                  
> org.apache.http.impl.client.cache.memcached.MemcachedHttpCacheStorage uses URL as cache
key - shouldn't.
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCLIENT-1153
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1153
>             Project: HttpComponents HttpClient
>          Issue Type: Bug
>          Components: HttpClient
>    Affects Versions: 4.1.1, 4.1.2
>            Reporter: Clinton Nielsen
>            Assignee: Jon Moore
>             Fix For: 4.1.3, 4.2 Alpha2
>
>
> Spy memcached has 250 defined as max key length:
> http://dustin.github.com/java-memcached-client/apidocs/constant-values.html#net.spy.memcached.MemcachedClientIF.MAX_KEY_LENGTH
> URLs can be (and often are) much longer than 250 characters.
> URLs should be hashed before being used as keys.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message