Tomcat 5, 6 중요 패치가 있었습니다. (아직 나오지 않은 Tomcat 5.5.29, 6.0.27에 추가될 예정입니다.)

 

1.    이슈

톰캣으로부터 1.8MB 파일을 다운받을 때, Bad file number IOException이 뜨는 것에 대해서 버그 요청을 하였습니다.

Caching을 쓰지 않으면 문제가 없다고 합니다.

https://issues.apache.org/bugzilla/show_bug.cgi?id=48760

 

 

Tomcat Context 설정 안에 아래와 설정이 가능합니다.

http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

cacheMaxSize

Maximum size of the static resource cache in kilobytes. If not specified, the default value is 10240 (10 megabytes).

cacheObjectMaxSize

Maximum size of the static resource that will be placed in the cache. If not specified, the default value is 512 (512 kilobytes). If this value is greater than cacheMaxSize/20 it will be reduced to cacheMaxSize/20.

 

하지만, 동시 접속 시 문제가 생길 수 있었습니다.

 

2.    패치 코드

http://svn.apache.org/viewvc?view=revision&revision=920858

public InputStream streamContent()

             throws IOException {

             if (binaryContent == null) {

-                inputStream = new FileInputStream(file);

+                FileInputStream fis = new FileInputStream(file);

+                inputStream = fis;

+                return fis;

             }

             return super.streamContent();

         }

 

빨간 색 라인의 inputStream을 클래스 변수로 서로 공유했기 때문에 multiple thread 상에서 문제가 생길 수 있는 코드입니다. 톰캣 개발쪽에서도 이렇게 중요한 코드를 놓치기도 합니다..

Instance를 하나 만들어서 return하는 구조로 패치되었습니다.

 

 

 

'Web service' 카테고리의 다른 글

아파치 문서 보기 #1  (0) 2010.04.28
Tomcat 7  (0) 2010.04.16
톰캣 7 개발 도구  (0) 2010.04.12
Tomcat 버그 패치 (Race Condition)  (0) 2010.04.06
AJP 연결 테스트 (AJP command line client)  (0) 2010.04.05
Posted by '김용환'
,