[ 
https://issues.apache.org/jira/browse/HDFS-525?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Suresh Srinivas updated HDFS-525:
---------------------------------

    Attachment: HDFS-525.patch

Patch uploaded to address the following multi threading issues:
# {{SimpleDateFormat.format()}} throws an exception ArrayIndexOfBounds on 
multiple threaded access.
# {{SimpleDateFormat.parse()}} throws parse exception or returns invalid parsed 
date

Both these issues are addressed by using a ThreadLocal variable. The attached 
unit tests first duplicate this issue for the SimpleDateFormat. It then ensures 
that the ThreadLocal implemenation does not have this issue.

Additionally, an exception in any of the followings lines in 
{{ListPathsServlet.doGet()}} is masked.
{noformat}
      final Map<String, String> root = buildRoot(request, doc);
      final String path = root.get("path");
      final boolean recur = "yes".equals(root.get("recursive"));
      final Pattern filter = Pattern.compile(root.get("filter"));
      final Pattern exclude = Pattern.compile(root.get("exclude"));
      ClientProtocol nnproxy = createNameNodeProxy(ugi);
{noformat}

The doc.endDocument in finally block encounters an exception and masks previous 
exception. This patch catches and prints the exception before proceeding to 
finally block.


> ListPathsServlet.java uses static SimpleDateFormat that has threading issues
> ----------------------------------------------------------------------------
>
>                 Key: HDFS-525
>                 URL: https://issues.apache.org/jira/browse/HDFS-525
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Suresh Srinivas
>            Assignee: Suresh Srinivas
>         Attachments: HDFS-525.patch
>
>
> SimpleDateFormat is not thread safe. Multiple threads accessing the servlet 
> can cause threading issues

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to