Background Image

FORUM

?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

* 질문 등록 시 다음의 내용을 꼭 기입하여 주세요.
OS
Window7 32bit, Linux 64bit 등
CUBRID Ver.
[cubrid_rel] 수행 결과
CUBRID TOOL Ver.
[도움말]-[버전정보] 확인
응용 환경(API)
java, php, odbc 등 입력

* CUBRID 응용 오류, SQL 오류 또는 SQL 튜닝 관련된 문의는 반드시 다음의 내용을 추가해 주세요. 비밀글이나 비밀 댓글도 가능합니다.
* 저희가 상황을 이해하고, 재현이 가능해야 알 수 있는 문제들이 많습니다. 가능한 정보/정황들을 부탁합니다.
에러 내용 및 재현 방법 재현 가능한 Source와 SQL
관련 테이블(인덱스, 키정보 포함) 정보 CUBRID 홈 디렉토리 아래 log 디렉토리 압축


-------------- 아래에 질문 사항을 기입해 주세요. ------------------------------------------------------------------------
http://www.cubrid.com/qna/3821016

에서 답변을 받은 후 아래와 같이 수정했습니다.


 private DataTable SelectDB(string query, string tableName)

        {

            DataSet ds = new DataSet(tableName);

            DataTable dt = null;

            CUBRIDConnection sqlConn = null;

            try

            {

                sqlConn = OpenDB();

                CUBRIDCommand sqlComm = new CUBRIDCommand(query, sqlConn);

                CUBRIDDataAdapter adapter = new CUBRIDDataAdapter(query, sqlConn);                

                adapter.Fill(ds, tableName);


                if (ds != null || ds.Tables.Count > 0)

                {

                    dt = ds.Tables[0];

                }


                adapter.Dispose();

                sqlComm.Close();

                sqlComm.Dispose();               

                ds.Dispose();                   

                CloseDB(sqlConn);

            }

            catch (Exception ex)

            {

                CloseDB(sqlConn);

                //Console.WriteLine("SelectDB-" + ex.Message);

                wMain.UI_LogAdd("SelectDB-" + ex.Message);

            }

            return dt;

        }

이후 일반적인 상황에서는 보호된 메모리 에러가 발생하지 않습니다만,

SELECT를 매우 빠르게 반복할경우 다시 문제가 발생합니다.


SELECT-> 결과 받고 -> SELECT 식으로 진행하고 있고,

서버와 클라이언트 같의 통신 및 SELECT 데이터 처리를 합치면 DB에 SELECT 하는 주기는 50ms 정도 되고요

이걸 100회 정도 1세트로 반복할때 두번에 한번은 메모리 에러가 발생합니다.


다음은 에러 내용 풀스택 입니다.

예외 발생: 'System.AccessViolationException'(CUBRID.Data.dll)

처리되지 않은 'System.AccessViolationException' 형식의 예외가 CUBRID.Data.dll에서 발생했습니다.

보호된 메모리를 읽거나 쓰려고 했습니다. 대부분 이러한 경우는 다른 메모리가 손상되었음을 나타냅니다.


'SPM_Server.exe'(CLR v4.0.30319: SPM_Server.exe): 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Packages\Debugger\Visualizers\Microsoft.VisualStudio.DebuggerVisualizers.dll'을(를) 로드했습니다. PDB 파일을 찾거나 열 수 없습니다.

'SPM_Server.exe'(CLR v4.0.30319: SPM_Server.exe): 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Packages\Debugger\Visualizers\Microsoft.VisualStudio.Debugger.DataSetVisualizer.dll'을(를) 로드했습니다. PDB 파일을 찾거나 열 수 없습니다.

0x7f3c 스레드가 종료되었습니다(코드: 0 (0x0)).


처리되지 않은 예외: System.AccessViolationException: 보호된 메모리를 읽거나 쓰려고 했습니다. 대부분 이러한 경우는 다른 메모리가 손상되었음을 나타냅니다.

   위치: System.Runtime.InteropServices.Marshal.CopyToManaged(IntPtr source, Object destination, Int32 startIndex, Int32 length)

   위치: CUBRID.Data.CUBRIDClient.CciInterface.cci_get_result_info(CUBRIDConnection conn, Int32 req_handle)

   위치: CUBRID.Data.CUBRIDClient.CUBRIDCommand.ExecuteInternal()

   위치: CUBRID.Data.CUBRIDClient.CUBRIDCommand.ExecuteDbDataReader(CommandBehavior behavior)

   위치: System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

   위치: System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

   위치: System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)

   위치: SPM_Server.DataControl.SelectDB(String query, String tableName) 파일 D:\Projects\Sbk\SbkProductManagement\SPM_Server\DataControl.cs:줄 121

   위치: SPM_Server.DataControl.Select_ViewHistroy(String sql, Int32 order) 파일 D:\Projects\Sbk\SbkProductManagement\SPM_Server\DataControl.cs:줄 849

   위치: SPM_Server.DataFunction.VHis_GetTable(Int64 sess, Int32 cnt) 파일 D:\Projects\Sbk\SbkProductManagement\SPM_Server\DataFunction.cs:줄 339

   위치: SPM_Server.TCPServer.ReqPacket(Packet packet) 파일 D:\Projects\Sbk\SbkProductManagement\SPM_Server\TCPServer.cs:줄 758

   위치: SPM_Server.TCPServer.waitText(Object key) 파일 D:\Projects\Sbk\SbkProductManagement\SPM_Server\TCPServer.cs:줄 343

   위치: System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   위치: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)

   위치: System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)

   위치: System.Threading.ThreadHelper.ThreadStart(Object obj)



/////////////////////추가////////////////////////

adapter.Dispose();

                sqlComm.Close();

                sqlComm.Dispose();               

                ds.Dispose();                  

부분을 추가 하면서 빈도가 조금 줄었습니다.


그리고 강제로 지연을 주어 SELECT 주기를 70ms, 100ms 식으로 늘릴경우 예외발생 빈도가 줄어듭니다.

하지만 총 시간이 그만큼 늘어나다보니 방법을 찾고 싶네요 ㅜ

  • ?
    큐브리드_김주현 2019.02.19 16:26
    큐브리드를 이용해 주셔서 감사합니다.


    우선, 불편을 드려 죄송합니다.

    말씀하신 사항이 SelectDB()함수를 호출하되, SelectDB()호출 주기가 50ms일 경우, 100회 반복 시 발생하는 것이지요??
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    SELECT-> 결과 받고 -> SELECT 식으로 진행하고 있고,
    서버와 클라이언트 같의 통신 및 SELECT 데이터 처리를 합치면 DB에 SELECT 하는 주기는 50ms 정도 되고요
    이걸 100회 정도 1세트로 반복할때 두번에 한번은 메모리 에러가 발생합니다.
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    재현테스트를 진행하여 문제원인을 찾아보도록 하겠습니다.

    감사합니다.
  • ?
    큐브리드_김주현 2019.02.20 16:17
    안녕하세요.

    상세히 알려주신 덕분에 내부 점검 결과 cs코드에서 Marshal.Copy() 메서드를 사용하는 부분에서 오류가 될만한 부분을 찾았습니다.
    되도록 빠른 시일안에 수정하여 release하도록 하겠습니다.

    상세한 설명 감사드립니다.

  1. SQLGate for CUBRID 영구 무료 라이선스 제공

    Date2020.04.09 Byadmin Views4285
    read more
  2. 브로커(CAS)수 질문드립니다!

    Date2023.06.05 By요시니 Views149
    Read More
  3. 데이터 이관 문의입니다.

    Date2023.05.30 Bykipo0821 Views125
    Read More
  4. 8.4.4 charset. Collation 확인 방법

    Date2023.05.24 By네오랜덤 Views177
    Read More
  5. 8.4.4버젼 charset 확인

    Date2023.05.23 By네오랜덤 Views182
    Read More
  6. 쿼리 속도 차이 질문

    Date2023.05.18 By하얀미스 Views140
    Read More
  7. spring boot 에서 HikariPool-1 - Driver does not support get/set network timeout for connections. (java.lang.UnsupportedOperationException) 질문 드립니다.

    Date2023.05.18 Bykjaminam Views732
    Read More
  8. cci 프로그래밍에서 DB LINK 관련 문의

    Date2023.05.18 Byjjune1206 Views125
    Read More
  9. 큐브리드 매니저 실행이 오류

    Date2023.05.18 By청주시청 Views98
    Read More
  10. ddl 추출

    Date2023.05.17 By네오랜덤 Views95
    Read More
  11. 하나의 쿼리에서 복수 테이블 업데이트 방법 문의

    Date2023.05.17 By도담도담 Views123
    Read More
  12. cubrid driver 설치 문의

    Date2023.05.08 By고구망구망 Views427
    Read More
  13. 큐브리드 매니저 접속 이 안됩니다. 확인 요청 드립니다.

    Date2023.04.28 By뿡이 Views127
    Read More
  14. Fk값 가져오기

    Date2023.04.24 By네오랜덤 Views161
    Read More
  15. 서버 메모리 교체 및 ha 상 데이터 삭제 절차

    Date2023.04.20 By레피엘 Views110
    Read More
  16. java stored procedure 에 loadjava 로 jar 파일 로드 시 java.lang.ClassNotFoundException 에러 문의

    Date2023.04.18 By개미가불쌍해 Views138
    Read More
  17. Cubrid stored procedure 스케쥴 등록 형식

    Date2023.04.17 ByRoy Views106
    Read More
  18. 암호화 함수 MDB_ENC 질문입니다

    Date2023.04.17 ByBE-DEV Views80
    Read More
  19. auto_increment 추가 방법 문의

    Date2023.04.14 By부패방지운영팀 Views242
    Read More
  20. CUBRID 사용자 계정 생성 관련 문의

    Date2023.04.14 By몽키스패너 Views127
    Read More
  21. order by 이후 rownum이 의도와 다르게 찍힙니다.

    Date2023.04.14 By바보똥개 Views135
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 199 Next
/ 199

Contact Cubrid

대표전화 070-4077-2110 / 기술문의 070-4077-2113 / 영업문의 070-4077-2112 / Email. contact_at_cubrid.com
Contact Sales