Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: increase the DNS allowed response size to solve Data too long for column 'dns_last_result' #4929

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gustavovalverde
Copy link

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Some DNS servers might reply with several IP addresses. This avoids errors like the following:

Failing: UPDATE `monitor` SET dns_last_result = 'Records: X' WHERE id = 1  - Data too long for column 'dns_last_result' at row 1

Type of change

Please delete any options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas (including JSDoc for methods)
  • My changes generates no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Some DNS servers might reply with several IP addresses. This avoids errors like the following:

```
Failing: UPDATE `monitor` SET dns_last_result = 'Records: X' WHERE id = 1  - Data too long for column 'dns_last_result' at row 1
```
@CommanderStorm
Copy link
Collaborator

Some DNS servers might reply with several IP addresses.

Can you provie an entry to reproduce this with?

@@ -86,7 +86,7 @@ async function createTables() {
table.text("accepted_statuscodes_json").notNullable().defaultTo("[\"200-299\"]");
table.string("dns_resolve_type", 5);
table.string("dns_resolve_server", 255);
table.string("dns_last_result", 255);
table.string("dns_last_result", 2000);
Copy link
Collaborator

@CommanderStorm CommanderStorm Jul 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are changing an already existing migration. Please add a new migration instead.
Currently, this does not fix the issue for others due to these lines not gettig applied.

I also don't think that this solves the problem of too large results getting stored. => please truncate what we try to store here instead

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a new migration instead.

This was the first thing I did on my side. Added a file called 2024-07-11-0000-dns-results.js with the following content:

exports.up = function (knex) {
  return knex.schema.table('monitor', function (table) {
    table.string('dns_last_result', 2000).alter();
  });
};

exports.down = function (knex) {
  return knex.schema.table('monitor', function (table) {
    table.string('dns_last_result', 255).alter();
  });
};

But this code did not get executed: https://github.com/louislam/uptime-kuma/blob/master/server/database.js#L393-L396, it seems it just happens when the DB is initialized, not every time the server start (or by a trigger):

await Database.patch();

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI @CommanderStorm, the migration issue I'm facing is using mariadb connection type

@louislam louislam added the question Further information is requested label Jul 12, 2024
@gustavovalverde
Copy link
Author

Can you provie an entry to reproduce this with?

@CommanderStorm Surely, you can test with mainnet.seeder.zfnd.org

@CommanderStorm CommanderStorm added area:monitor Everything related to monitors type:enhance-existing feature wants to enhance existing monitor pr:please address review comments this PR needs a bit more work to be mergable labels Jul 12, 2024
@CommanderStorm CommanderStorm changed the title fix(db): increase the DNS allowed response size fix: increase the DNS allowed response size to solve Data too long for column 'dns_last_result' Jul 12, 2024
@CommanderStorm CommanderStorm marked this pull request as draft July 16, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:monitor Everything related to monitors pr:please address review comments this PR needs a bit more work to be mergable question Further information is requested type:enhance-existing feature wants to enhance existing monitor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants