[SOLVED] MSSQL doesn't work

Hi,
we are currently evaluating metabase running in docker accessing a Microsoft SQL Server 2019. We've tried to create a first model from a simple SQL-Query, but only sometimes we see a result table in metabase. If we do a refresh or go into editor, we've got an exception in the docker log:

2022-06-20 12:31:58,934 ERROR middleware.catch-exceptions :: Fehlerverarbeitungsanfrage: null
{:database_id 7,
 :started_at #t "2022-06-20T12:31:56.573918Z[GMT]",

 :json_query
 {:constraints {:max-results 10000, :max-results-bare-rows 2000},
  :type :native,
  :middleware {:js-int-to-string? true, :ignore-cached-results? false, :process-viz-settings? false},

e

y
   "SELECT TOP 1048575 \"dbo\".\"AgentFZ\".\"FZRowID\" AS \"FZRowID\", \"dbo\".\"AgentFZ\".\"PersNr\" AS \"PersNr\", \"dbo\".\"AgentFZ\".\"WorkSession\" AS \"WorkSession\", \"dbo\".\"AgentFZ\".\"FZ\" AS \"FZ\", \"dbo\".\"AgentFZ\".\"BeginDate\" AS \"BeginDate\", \"dbo\".\"AgentFZ\".\"Seconds\" AS \"Seconds\", \"dbo\".\"AgentFZ\".\"Source\" AS \"Source\", \"dbo\".\"AgentFZ\".\"ACDGroup\" AS \"ACDGroup\", \"dbo\".\"AgentFZ\".\"CallID\" AS \"CallID\", \"dbo\".\"AgentFZ\".\"lastUpdate\" AS \"lastUpdate\", \"ACDGroup\".\"ACDGroupName\"\nFROM \"dbo\".\"AgentFZ\" \nLEFT JOIN \"dbo\".\"AgentFZExt\" AS \"AgentFZExt\" ON \"AgentFZ\".\"FZRowID\" = \"AgentFZExt\".\"FZRowID\" \nLEFT JOIN \"ACDDomain\".\"dbo\".\"ACDGroup\" AS \"ACDGroup\" ON \"AgentFZ\".\"ACDGroup\" = \"ACDGroup\".\"ACDGroup\"\nORDER BY \"dbo\".\"AgentFZ\".\"lastUpdate\" DESC",
   :template-tags {}},
  :database 7,
  :parameters [],
  :async? true,
  :cache-ttl nil},
 :status :failed,
 :class org.eclipse.jetty.io.EofException,

 :stacktrace
 ["org.eclipse.jetty.server.HttpOutput.checkWritable(HttpOutput.java:765)"
  "org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:795)"
  "java.base/java.util.zip.DeflaterOutputStream.flush(Unknown Source)"
  "--> async.streaming_response$delay_output_stream$fn__18965.invoke(streaming_response.clj:119)"
  "async.streaming_response.proxy$java.io.OutputStream$ff19274a.flush(Unknown Source)"
  "query_processor.streaming.json$fn$reify__38495.finish_BANG_(json.clj:91)"
  "query_processor.streaming$streaming_reducedf$fn__39272.invoke(streaming.clj:128)"
  "query_processor.context$reducedf.invokeStatic(context.clj:77)"
  "query_processor.context$reducedf.invoke(context.clj:72)"
  "query_processor.context.default$default_reducef.invokeStatic(default.clj:63)"
  "query_processor.context.default$default_reducef.invoke(default.clj:48)"
  "query_processor.context$reducef.invokeStatic(context.clj:69)"
  "query_processor.context$reducef.invoke(context.clj:62)"
  "query_processor.context.default$default_runf$respond_STAR___38229.invoke(default.clj:68)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:507)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:494)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:486)"
  "driver.sql_jdbc$fn__83571.invokeStatic(sql_jdbc.clj:54)"
  "driver.sql_jdbc$fn__83571.invoke(sql_jdbc.clj:52)"
  "query_processor.context$executef.invokeStatic(context.clj:59)"
  "query_processor.context$executef.invoke(context.clj:48)"
  "query_processor.context.default$default_runf.invokeStatic(default.clj:67)"
  "query_processor.context.default$default_runf.invoke(default.clj:65)"
  "query_processor.context$runf.invokeStatic(context.clj:45)"
  "query_processor.context$runf.invoke(context.clj:39)"
  "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:12)"
  "query_processor.reducible$identity_qp.invoke(reducible.clj:9)"
  "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___51446.invoke(cache.clj:220)"
  "query_processor.middleware.permissions$check_query_permissions$fn__47229.invoke(permissions.clj:109)"
  "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__50387.invoke(mbql_to_native.clj:23)"
  "query_processor$fn__52919$combined_post_process__52924$combined_post_process_STAR___52925.invoke(query_processor.clj:207)"
  "query_processor$fn__52919$combined_pre_process__52920$combined_pre_process_STAR___52921.invoke(query_processor.clj:204)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__51367$fn__51372.invoke(resolve_database_and_driver.clj:35)"
  "driver$do_with_driver.invokeStatic(driver.clj:75)"
  "driver$do_with_driver.invoke(driver.clj:71)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database_and_driver$fn__51367.invoke(resolve_database_and_driver.clj:34)"
  "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__47472.invoke(fetch_source_query.clj:281)"
  "query_processor.middleware.store$initialize_store$fn__47660$fn__47661.invoke(store.clj:11)"
  "query_processor.store$do_with_store.invokeStatic(store.clj:44)"
  "query_processor.store$do_with_store.invoke(store.clj:38)"
  "query_processor.middleware.store$initialize_store$fn__47660.invoke(store.clj:10)"
  "query_processor.middleware.normalize_query$normalize$fn__51639.invoke(normalize_query.clj:22)"
  "query_processor.middleware.constraints$add_default_userland_constraints$fn__48729.invoke(constraints.clj:53)"
  "query_processor.middleware.process_userland_query$process_userland_query$fn__51578.invoke(process_userland_query.clj:145)"
  "query_processor.middleware.catch_exceptions$catch_exceptions$fn__51950.invoke(catch_exceptions.clj:162)"
  "query_processor.reducible$async_qp$qp_STAR___44199$thunk__44201.invoke(reducible.clj:100)"
  "query_processor.reducible$async_qp$qp_STAR___44199$fn__44203.invoke(reducible.clj:105)"],
 :card_id 13,
 :context :question,
 :error "Closed",
 :row_count 0,
 :running_time 0,
 :data {:rows [], :cols []}}

We've tried to disable caching, resync schemas, reevaluate field values, but nothing helped.
We've also tried to query only the top 100 with the same result.

Doing the same query from other tools like MS SQL Server Management Studio or HeidiSQL works every time.

Looks like a basic problem, so we can't continue evaluating metabase without solving this first.

Hi @Euratel
Post "Diagnostic Info" from Admin > Troubleshooting.
The error indicates that the connection between the browser and Metabase is closed before the results could be sent to the browser.
https://www.metabase.com/docs/latest/troubleshooting-guide/proxies.html

1 Like

Thank you, you pushed me to the right direction. I've jumped the haproxy and open the ui on the metabase port and there it works.

For everyone using HAProxy (Version 1.8 on CentOS/Rockylinux 8) in front of Metabase:

The option "http-pretend-keepalive" is needed, to tell the metabase webserver not to close the connection.

This worked for me:

backend metabase
    option http-pretend-keepalive
    ...
1 Like