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하도록 하겠습니다.

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

List of Articles
번호 제목 글쓴이 날짜 조회 수
공지 CUBRID 사용자를 위한 DBeaver 도구 출시 안내 admin 2024.04.23 65
공지 SQLGate for CUBRID 영구 무료 라이선스 제공 file admin 2020.04.09 4465
3879 ADO.NET에서 자바 저장함수 호출 2 kdknim21 2014.11.01 8420
3878 ADO.Net 사용중입니다. 상태확인 방법을 알고 싶습니다. 1 CUCUCUCU 2015.10.22 5691
3877 ADO.net Driver 변경 시 cascci.dll 로드할 수 없다는 오류 1 물병 2017.07.25 503
3876 ADO.net 또는 ODBC에 대한 질문입니다. 12 세스카 2012.03.20 13377
3875 ADO이용시 OLEDB Driver에러 2 flypig 2010.01.29 15619
3874 AIX에 CUBRID 설치 후 오류사항 문의 1 최명호 2015.06.02 7735
3873 ALTER 로 PK 여러 개 지정하고싶습니다 4 사탕구름 2021.07.21 834
3872 ARRAY 데이터 타입에 대한 SQL 질문 3 지용 2010.10.08 10246
3871 AUTO INCREASE 가 편집이 안됨 2 file 큐브리드어려워요 2022.02.08 268
3870 AUTO_INCREMENT 수동 증가 문의 2 cubrid초보 2021.08.19 727
3869 AUTO_INCREMENT 컬럼 이용시 2 hyperhand 2009.12.22 17649
3868 AVG 함수관련 질문드려요 1 구름마음 2013.06.10 13678
3867 Ado.NET : Cannot connect to CUBRID CAS 오류 2 websiter 2017.05.05 57878
3866 Ado.net. ExecuteNonQuery의 반환값이 항상 0 입니다. 2 모비23 2019.01.08 1484
3865 An IOException was caught during reading the inputstream 1 익명2 2015.11.26 6872
3864 An IOException was caught during reading the inputstream 1 익명2 2015.11.26 6833
3863 An IOException was caught during reading the inputstream. 오류 조치방법 좀 알려주세요. 1 ldev27 2019.10.29 316
3862 An internal error occurred during: "Fetching children of <DB명>". java.lang.NullPointerException 에러 4 ysh 2021.04.06 484
3861 Apm_setup7로 자동설치시 연동이 안되는데... 1 또랑 2010.11.08 8277
3860 Archive Log만으로 타임복구가 가능한가요? 4 핑핑크 2016.04.29 9820
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 200 Next
/ 200

Contact Cubrid

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