softace / sqliteodbc

SQLite ODBC driver
http://www.sqliteodbc.org
Other
107 stars 32 forks source link

ERROR: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. #13

Open labanca opened 1 year ago

labanca commented 1 year ago

Hi,

I tried connecting power BI to a SQLite database using your sqlite odbc driver, but I got the error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupted."

Using another (commercial) ODBC driver the connection was performed without problems. Is there anything that can be done to resolve this error?

Here is the complete error:

Feedback Type:
Frown (Error)

Error Message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Stack Trace:
Microsoft.Mashup.Host.Document.SerializedException

Server stack trace: 

Exception rethrown at [0]: 
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Mashup.OleDbProvider.DataHost.NonBufferingMashupEvaluator.MashupEvaluation.OnEvaluationComplete(AsyncResult`1 result)

Exception rethrown at [1]: 
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.Mashup.OleDbProvider.MashupCommandEvaluation.get_PageReader()
   at Microsoft.Mashup.OleDbProvider.TracingRowset.Microsoft.OleDb.IEvaluationResultSource.WaitForResults()

Stack Trace Message:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

Invocation Stack Trace:
   at Microsoft.Mashup.Host.Document.ExceptionExtensions.GetCurrentInvocationStackTrace()
   at Microsoft.Mashup.Client.UI.Shared.StackTraceInfo..ctor(String exceptionStackTrace, String invocationStackTrace, String exceptionMessage)
   at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.GetStackTraceInfo(Exception e)
   at Microsoft.PowerBI.Client.Windows.Telemetry.PowerBIUserFeedbackServices.ReportException(IWindowHandle activeWindow, IUIHost uiHost, FeedbackPackageInfo feedbackPackageInfo, Exception e, Boolean useGDICapture)
   at Microsoft.Mashup.Client.UI.Shared.UnexpectedExceptionHandler.<>c__DisplayClass14_0.<HandleException>b__0()
   at Microsoft.Mashup.Host.Document.SynchronizationContextExtensions.<>c__DisplayClass2_0.<SendAndMarshalExceptions>b__0(Object null)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Microsoft.Mashup.Client.UI.Windows.DialogWindowBase.ShowModal(IWindowHandle windowHandle)
   at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
   at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.TryShowDialog(Report report, IExceptionHandler exceptionHandler, IPowerBIWindowService windowService, IPowerBIQueryUIService queryServices, IDesktopModelingHost modelingHost, LocalizedString title, LoadToModelContext loadToModelContext)
   at Microsoft.PowerBI.Client.Windows.FloatingDialog.KoLoadToReportDialog.<>c__DisplayClass16_0.<TryShowDialogForQueries>b__0()
   at Microsoft.PowerBI.Client.Windows.Report.<>c__DisplayClass68_0`1.<SynchronizeLooselyWithQueries>b__0()
   at Microsoft.PowerBI.Client.Windows.Report.<SynchronizeLooselyWithQueriesAsync>d__69`1.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueriesAsync[T](Func`1 getTask)
   at Microsoft.PowerBI.Client.Windows.Report.SynchronizeLooselyWithQueries[T](Func`1 action)
   at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.LoadQueries(IEnumerable`1 queriesToLoad)
   at Microsoft.PowerBI.Client.Windows.PowerBIDataImporter.OnImportSuccess(IEnumerable`1 addedQueries, DataImportDestination destination)
   at Microsoft.Mashup.Client.UI.Shared.DataImporter.ProcessImportedQueries(IEnumerable`1 importedQueries, DataImportDestination destination)
   at Microsoft.Mashup.Client.UI.Shared.DataImporter.ImportNavigationSource(Query query)
   at Microsoft.Mashup.Client.UI.Shared.DataImporter.OnGetPreviewResult(PreviewResult preview, Query query, String sourceID, String formulaTitle, Nullable`1 explicitImportDestination, Boolean isNewQuery, Boolean isFromEditor)
   at Microsoft.Mashup.Client.UI.Shared.DataImporter.GetPreviewResult(Query query, String sourceID, String formulaTitle, Boolean isNewQuery, Boolean isFromEditor, Nullable`1 explicitImportDestination)
   at Microsoft.Mashup.Client.UI.Shared.DataImporter.<>c__DisplayClass87_0.<OnQuerySettingsResolved>b__0()
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Delegate.DynamicInvokeImpl(Object[] args)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
   at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at Microsoft.Mashup.Client.UI.Shared.WindowManager.ShowModal[T](T dialog, Func`1 showModalFunction)
   at Microsoft.PowerBI.Client.Program.<>c__DisplayClass5_1.<RunApplication>b__4()
   at Microsoft.PowerBI.Client.Windows.IExceptionHandlerExtensions.<>c__DisplayClass3_0.<HandleExceptionsWithNestedTasks>b__0()
   at Microsoft.Mashup.Host.Document.ExceptionHandlerExtensions.HandleExceptions(IExceptionHandler exceptionHandler, Action action)
   at Microsoft.PowerBI.Client.Program.RunApplication(String[] args)
   at Microsoft.PowerBI.Client.Program.Main(String[] args)

PowerBINonFatalError:
{"AppName":"PBIDesktop","AppVersion":"2.115.842.0","ModuleName":"","Component":"Microsoft.Mashup.OleDbProvider.DataHost.NonBufferingMashupEvaluator.MashupEvaluation","Error":"Microsoft.Mashup.Host.Document.SerializedException - Microsoft.Mashup.Evaluator.Interface.ErrorException","MethodDef":"OnEvaluationComplete","ErrorOffset":""}

Snapshot Trace Logs:
C:\Users\m752587\AppData\Local\Microsoft\Power BI Desktop\FrownSnapShot610c3325-e1e7-411c-b97f-c85a1c04f6bb.zip

Model Default Mode:
Empty

Model Version:
PowerBI_V1

Performance Trace Logs:
C:\Users\m752587\AppData\Local\Microsoft\Power BI Desktop\PerformanceTraces.zip

Enabled Preview Features:
PBI_enableWebView2
PQ_WebView2Connector
PBI_sparklines
PBI_scorecardVisual
PBI_fieldParametersSuperSwitch
PBI_horizontalFusion
PBI_relationshipEditPane
PBI_setLabelOnExportPdf

Disabled Preview Features:
PBI_shapeMapVisualEnabled
PBI_SpanishLinguisticsEnabled
PBI_qnaLiveConnect
PBI_azureMapVisual
PBI_compositeModelsOverAS
PBI_b2bExternalDatasetSharing
PBI_enhancedTooltips
PBI_NlToDax
PBI_optimizeTabRibbon
PBI_angularRls
PBI_onObject

Disabled DirectQuery Options:
TreatHanaAsRelationalSource

Cloud:
GlobalCloud

PowerBINonFatalError_ErrorDescription:
Microsoft.Mashup.Evaluator.Interface.ErrorException

PowerBIUserFeedbackServices_IsReported:
True

Formulas:

section Section1;

shared dm_acao = let
    Source = Odbc.DataSource("database=C:\Users\m752587\Downloads\sqlite-carga-despesa-main\sqlite-carga-despesa-main\database\dadosmg.db;dsn=SQLite3 Datasource", [HierarchicalNavigation=true]),
    dm_acao_Table = Source{[Name="dm_acao",Kind="Table"]}[Data]
in
    dm_acao_Table;
felixrech commented 5 months ago

We had the same problem at my company but I managed to find a solution for this issue. In the ODBC connection screen, do the following:

  1. Enable the step API, set your connection string to something like this: Database=<path_to_your_db>;StepAPI=true
  2. Allow LIMIT and OFFSET in the row reduction clauses

Give it a try and see if it works for you, too! But I guess a bugfix on the software side would be much preferable to such workarounds...