dbeaver / cloudbeaver

Cloud Database Manager
https://dbeaver.com/
Apache License 2.0
3.37k stars 370 forks source link

Resource Error: Network request failed / 503 HTTP code on api/ws #2848

Open morodest opened 4 weeks ago

morodest commented 4 weeks ago

Hello! Sometimes I get 503 errors in cloudbeaver logs. Log file in the attache: cb_error_session.log

It looks like the client is connecting to the server from an old session, but it has already been deleted. How can I increase the session lifetime or otherwise fix this error?

To Reproduce Steps to reproduce the behavior:

  1. Open cloudbeaver in browser
  2. Do nothing
  3. Sometime you will get this error

Screenshots 2024-08-15 16 51 33 2024-08-15 16 51 27

Additional context Our Cloudbeaver CE hosted on the kubernetes cluster with Istio service mesh Backend version: 24.1.3.202407220833 Frontend version: 24.1.3.202407220836

EvgeniaBzzz commented 3 weeks ago

Hi @morodest We can't reproduce that on our side. The problem seems to be with websockets. It would be very helpful if you provide us with any extra information. What server setting do you have? Have you changed the default CB configs? When exactly the error appears? If you open CB and do absolultely nothing, don't even authenticate? How do you authenticate? (auth log will also be useful) What helps you after the error? Page refresh or server restart?

morodest commented 3 weeks ago

Hi, @EvgeniaBzzz The problem is more often reproduced in Safari when we work via VPN. If you leave the screen open for some time, you can get a 503 error.

Our application settings: cat workspace/.data/.cloudbeaver.runtime.conf

{
  "server": {
    "serverName": "CloudBeaver CE Server",
    "serverURL": "https://cloudbeaver.example.com/",
    "expireSessionAfterPeriod": 1800000,
    "productSettings": {
      "core.app.logViewer.logBatchSize": 1000.0,
      "core.app.logViewer.maxFailedRequests": 3.0,
      "core.app.logViewer.maxLogRecords": 2000.0,
      "core.app.logViewer.refreshTimeout": 3000.0,
      "core.localization.language": "ru",
      "core.localization.localization": "en",
      "core.theming.defaultTheme": "light",
      "core.theming.theme": "light",
      "core.user.defaultLanguage": "en",
      "core.user.defaultTheme": "light",
      "core_events.notificationsPool": 20.0,
      "plugin.data-spreadsheet.hidden": false,
      "plugin.data-viewer.disableCopyData": false,
      "plugin.data-viewer.disableEdit": false,
      "plugin.data-viewer.export.disabled": false,
      "plugin.data-viewer.fetchMax": "1000",
      "plugin.log-viewer.disabled": false,
      "plugin.log-viewer.logBatchSize": 1000.0,
      "plugin.log-viewer.maxFailedRequests": 3.0,
      "plugin.log-viewer.maxLogRecords": 2000.0,
      "plugin.log-viewer.refreshTimeout": 3000.0,
      "plugin.sql-editor.autoSave": true,
      "plugin.sql-editor.disabled": false,
      "plugin.sql-editor.maxFileSize": 10240.0,
      "plugin_data_export.disabled": false,
      "plugin_data_spreadsheet_new.hidden": false,
      "sql.proposals.insert.table.alias": "NONE",
      "SQLEditor.ContentAssistant.proposals.long.name": false
    },
    "database": {
      "driver": "h2_embedded_v2",
      "url": "jdbc:h2:/opt/cloudbeaver/workspace/.data/cb.h2v2.dat",
      "initialDataConfiguration": "conf/initial-data.conf",
      "backupEnabled": false,
      "pool": {
        "minIdleConnections": 4.0,
        "validationQuery": "SELECT 1",
        "maxIdleConnections": 10.0,
        "maxConnections": 100.0
      }
    },
    "sm": {
      "passwordPolicy": {
        "minLength": "${CLOUDBEAVER_POLICY_MIN_LENGTH:8.0}",
        "minNumberCount": "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1.0}",
        "minSymbolCount": "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0.0}",
        "requireMixedCase": "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}"
      }
    }
  },
  "app": {
    "anonymousAccessEnabled": false,
    "supportsCustomConnections": true,
    "publicCredentialsSaveEnabled": true,
    "adminCredentialsSaveEnabled": true,
    "enableReverseProxyAuth": false,
    "forwardProxy": true,
    "linkExternalCredentialsWithUser": true,
    "redirectOnFederatedAuth": false,
    "resourceManagerEnabled": true,
    "showReadOnlyConnectionInfo": false,
    "grantConnectionsAccessToAnonymousTeam": false,
    "systemVariablesResolvingEnabled": false,
    "resourceQuotas": {
      "dataExportFileSizeLimit": 1.0E7,
      "resourceManagerFileSizeLimit": 500000.0,
      "sqlMaxRunningQueries": 100.0,
      "sqlResultSetRowsLimit": 100000.0,
      "sqlResultSetMemoryLimit": 2000000.0,
      "sqlTextPreviewMaxLength": 4096.0,
      "sqlBinaryPreviewMaxLength": 261120.0
    },
    "defaultNavigatorSettings": {},
    "enabledFeatures": [],
    "enabledAuthProviders": [
      "local"
    ],
    "enabledDrivers": [],
    "disabledDrivers": [
      "sqlite:sqlite_jdbc",
      "h2:h2_embedded",
      "h2:h2_embedded_v2",
      "generic:duckdb_jdbc"
    ],
    "authConfigurations": [
      {
        "id": "reverseProxy",
        "provider": "reverseProxy",
        "displayName": "Reverse Proxy",
        "disabled": false,
        "iconURL": "",
        "description": "Automatically created provider after changing Reverse Proxy configuration way in 23.3.4 version",
        "parameters": {
          "first-name-header": "X-First-name",
          "user-header": "X-User",
          "team-header": "X-Team",
          "last-name-header": "X-Last-name"
        }
      }
    ]
  }
}

cat conf/cloudbeaver.conf

{
    server: {
        serverPort: 8978,
        workspaceLocation: "workspace",
        contentRoot: "web",
        driversLocation: "drivers",
        sslConfigurationPath:"${CLOUDBEAVER_SSL_CONF_PATH:workspace/.data/ssl-config.xml}",
        rootURI: "/",
        serviceURI: "/api/",
        productSettings: {
            # Global properties
            core.theming.theme: 'light',
            core.localization.localization: 'ru',
            plugin.sql-editor.autoSave: true,
            plugin.sql-editor.disabled: false,
            # max size of the file that can be uploaded to the editor (in kilobytes)
            plugin.sql-editor.maxFileSize: 10240,
            plugin.log-viewer.disabled: false,
            plugin.log-viewer.logBatchSize: 1000,
            plugin.log-viewer.maxFailedRequests: 3,
            plugin.log-viewer.maxLogRecords: 2000,
            plugin.log-viewer.refreshTimeout: 3000,
            sql.proposals.insert.table.alias: PLAIN
        },
        expireSessionAfterPeriod: 1800000,
        develMode: false,
        enableSecurityManager: false,
        sm: {
            enableBruteForceProtection: "${CLOUDBEAVER_BRUTE_FORCE_PROTECTION_ENABLED:true}",
            maxFailedLogin: "${CLOUDBEAVER_MAX_FAILED_LOGINS:10}",
            minimumLoginTimeout: "${CLOUDBEAVER_MINIMUM_LOGIN_TIMEOUT:1}",
            blockLoginPeriod: "${CLOUDBEAVER_BLOCK_PERIOD:300}",
            passwordPolicy: {
                minLength: "${CLOUDBEAVER_POLICY_MIN_LENGTH:8}",
                requireMixedCase: "${CLOUDBEAVER_POLICY_REQUIRE_MIXED_CASE:true}",
                minNumberCount: "${CLOUDBEAVER_POLICY_MIN_NUMBER_COUNT:1}",
                minSymbolCount: "${CLOUDBEAVER_POLICY_MIN_SYMBOL_COUNT:0}"
            }
        },
        database: {
            driver: "${CLOUDBEAVER_DB_DRIVER:h2_embedded_v2}",
            url: "${CLOUDBEAVER_DB_URL:jdbc:h2:${workspace}/.data/cb.h2v2.dat}",
            schema: "${CLOUDBEAVER_DB_SCHEMA:''}",
            user: "${CLOUDBEAVER_DB_USER:''}",
            password: "${CLOUDBEAVER_DB_PASSWORD:''}",
            initialDataConfiguration: "${CLOUDBEAVER_DB_INITIAL_DATA:conf/initial-data.conf}",
            pool: {
                minIdleConnections: "${CLOUDBEAVER_DB_MIN_IDLE_CONNECTIONS:4}",
                maxIdleConnections: "${CLOUDBEAVER_DB_MAX_IDLE_CONNECTIONS:10}",
                maxConnections: "${CLOUDBEAVER_DB_MAX_CONNECTIONS:100}",
                validationQuery: "${CLOUDBEAVER_DB_VALIDATION_QUERY:SELECT 1}"
            },
            backupEnabled: "${CLOUDBEAVER_DB_BACKUP_ENABLED:true}"
        }
    },
    app: {
        anonymousAccessEnabled: true,
        anonymousUserRole: "user",
        defaultUserTeam: "user",
        grantConnectionsAccessToAnonymousTeam: false,
        supportsCustomConnections: false,
        showReadOnlyConnectionInfo: false,
        systemVariablesResolvingEnabled: "${CLOUDBEAVER_SYSTEM_VARIABLES_RESOLVING_ENABLED:false}",
        forwardProxy: true,
        publicCredentialsSaveEnabled: true,
        adminCredentialsSaveEnabled: true,
        resourceManagerEnabled: true,
        resourceQuotas: {
            dataExportFileSizeLimit: 10000000,
            resourceManagerFileSizeLimit: 500000,
            sqlMaxRunningQueries: 100,
            sqlResultSetRowsLimit: 100000,
            sqlResultSetMemoryLimit: 2000000,
            sqlTextPreviewMaxLength: 4096,
            sqlBinaryPreviewMaxLength: 261120
        },
        enabledAuthProviders: [
            "local"
        ],
        disabledDrivers: [
            "sqlite:sqlite_jdbc",
            "h2:h2_embedded",
            "h2:h2_embedded_v2"
        ],
        disabledBetaFeatures: [
        ]
    }
}

When exactly the error appears? If you open CB and do absolultely nothing, don't even authenticate?

Just after authentication. I opened CB in Safari, logged in and didn’t touch it for the next hour.

How do you authenticate? (auth log will also be useful)

with local AuthProviders. Where I can find auth log?

What helps you after the error? Page refresh or server restart?

Refreshing the page is enough

Screenshot 2024-08-21 at 12 26 23

We get errors quite often.

Thank you!

LonwoLonwo commented 1 week ago

Hello @morodest

Please update your CloudBeaver version and check if your issue still exists.