Closed Lokizzle closed 11 months ago
Please provide a bigger chunk of the log. What precedes the PG error.
here you go:
I, [2023-08-09T07:31:22.951054 #359272] INFO -- : [43eb8468-2d57-45bb-aaab-a31cf1499048] Started POST "/projects/atkis-gen/dmsf/upload/commit" for 172.31.255.2 at 2023-08-09 07:31:22 +0200
I, [2023-08-09T07:31:22.952013 #359272] INFO -- : [43eb8468-2d57-45bb-aaab-a31cf1499048] Processing by DmsfUploadController#commit_files as HTML
I, [2023-08-09T07:31:22.952110 #359272] INFO -- : [43eb8468-2d57-45bb-aaab-a31cf1499048] Parameters: {"utf8"=>"✓", "authenticity_token"=>"T0lFPYbwLO2EnjzvG5kCc/733sZwPoPPfd6vi9BTEMEvLaAnATEYmx+Cah4KJTLusVZ17WccTmD3NBq9Uz6szw==", "commited_files"=>{"0"=>{"disk_filename"=>"230809053106_Server.xlsx", "tempfile_path"=>"/data/redmine/redmine-5.0.5/files/2023/08/230809073102_Server.xlsx", "size"=>"10146", "mime_type"=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "digest"=>"6eed3c38a44db9428d1b09ac9e4333c6ad42918f4872e80d037af2cbd3aed271", "title"=>"Server", "name"=>"Server.xlsx", "description"=>"test", "version_major"=>"0", "version_minor"=>"1", "version_patch"=>"", "comment"=>""}}, "name"=>"9,91 KB", "commit"=>"Upload", "id"=>"atkis-gen"}
I, [2023-08-09T07:31:22.956860 #359272] INFO -- : [43eb8468-2d57-45bb-aaab-a31cf1499048] Current user: erden (id=227)
I, [2023-08-09T07:31:22.966729 #359272] INFO -- : [43eb8468-2d57-45bb-aaab-a31cf1499048] Completed 500 Internal Server Error in 15ms (ActiveRecord: 3.3ms | Allocations: 3982)
F, [2023-08-09T07:31:22.967812 #359272] FATAL -- : [43eb8468-2d57-45bb-aaab-a31cf1499048]
[43eb8468-2d57-45bb-aaab-a31cf1499048] ActiveRecord::NotNullViolation (PG::NotNullViolation: FEHLER: NULL-Wert in Spalte »id« verletzt Not-Null-Constraint
DETAIL: Fehlgeschlagene Zeile enthält (null, 115, null, Server.xlsx, f, 0, null, 2023-08-09 07:31:22.965337, 2023-08-09 07:31:22.965337).
):
[43eb8468-2d57-45bb-aaab-a31cf1499048]
[43eb8468-2d57-45bb-aaab-a31cf1499048] plugins/redmine_dmsf/app/helpers/dmsf_upload_helper.rb:91:in block in commit_files_internal' [43eb8468-2d57-45bb-aaab-a31cf1499048] plugins/redmine_dmsf/app/helpers/dmsf_upload_helper.rb:30:in
commit_files_internal'
[43eb8468-2d57-45bb-aaab-a31cf1499048] plugins/redmine_dmsf/app/controllers/dmsf_upload_controller.rb:127:in commit_files_internal' [43eb8468-2d57-45bb-aaab-a31cf1499048] plugins/redmine_dmsf/app/controllers/dmsf_upload_controller.rb:86:in
commit_files'
[43eb8468-2d57-45bb-aaab-a31cf1499048] lib/redmine/sudo_mode.rb:61:in `sudo_mode'
i already tried this one:
redmine_production=# DELETE FROM dmsf_files WHERE id = 0;
DELETE 0
but it seems its empty
It seems to me that your dmsf_files
table doesn't generate id for new records. Check in the database the Default column for id
. It should look like follows:
Table "public.dmsf_files"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
--------------------+-----------------------------+-----------+----------+----------------------------------------+----------+-------------+--------------+-------------
id | integer | | not null | nextval('dmsf_files_id_seq'::regclass) | plain | | |
project_id | integer | | not null | | plain | | |
dmsf_folder_id | integer | | | | plain | | |
name | character varying | | not null | | extended | | |
notification | boolean | | | false | plain | | |
deleted | integer | | not null | 0 | plain | | |
deleted_by_user_id | integer | | | | plain | | |
created_at | timestamp without time zone | | not null | | plain | | |
updated_at | timestamp without time zone | | not null | | plain | | |
Indexes:
"dmsf_files_pkey" PRIMARY KEY, btree (id)
"index_dmsf_files_on_dmsf_folder_id" btree (dmsf_folder_id)
"index_dmsf_files_on_project_id" btree (project_id)
Access method: heap
this is my dmsf_files table
# \d+ dmsf_files
Tabelle »public.dmsf_files«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert | Speicherung | Statistikziel | Beschreibung
--------------------+-----------------------------+--------------+---------------+-------------+-------------+---------------+--------------
id | integer | | not null | | plain | |
project_id | integer | | not null | | plain | |
dmsf_folder_id | integer | | | | plain | |
name | character varying | | not null | | extended | |
notification | boolean | | | false | plain | |
deleted | integer | | not null | 0 | plain | |
deleted_by_user_id | integer | | | | plain | |
created_at | timestamp without time zone | | not null | | plain | |
updated_at | timestamp without time zone | | not null | | plain | |
Indexe:
"dmsf_files_pkey" PRIMARY KEY, btree (id)
"index_dmsf_files_on_dmsf_folder_id" btree (dmsf_folder_id)
"index_dmsf_files_on_project_id" btree (project_id)
i tried this now:
CREATE SEQUENCE dmsf_files_id_seq;
ALTER TABLE dmsf_files ALTER COLUMN id SET DEFAULT nextval('dmsf_files_id_seq'::regclass);
GRANT USAGE, SELECT ON SEQUENCE dmsf_files_id_seq TO redmine;
unfortuantely now i get a new error.
I, [2023-08-09T07:58:13.900692 #359272] INFO -- : [1b0ccece-c1bb-4e69-992a-ea4c0c3c11c0] Completed 500 Internal Server Error in 12ms (ActiveRecord: 2.7ms | Allocations: 4731) F, [2023-08-09T07:58:13.901321 #359272] FATAL -- : [1b0ccece-c1bb-4e69-992a-ea4c0c3c11c0] [1b0ccece-c1bb-4e69-992a-ea4c0c3c11c0] ActiveRecord::NotNullViolation (PG::NotNullViolation: FEHLER: NULL-Wert in Spalte »id« verletzt Not-Null-Constraint DETAIL: Fehlgeschlagene Zeile enthält (null, 1, null, Server.xlsx, 230809055813_1_Server.xlsx, 10146, application/vnd.openxmlformats-officedocument.spreadsheetml.shee..., Server, test, null, 0, 1, , 0, null, 227, 2023-08-09 07:58:13.899482, 2023-08-09 07:58:13.899482, null, null, null, null, null, 6eed3c38a44db9428d1b09ac9e4333c6ad42918f4872e80d037af2cbd3aed271, null).
translated to english:
Failed row contains (null, 1, null, Server.xlsx, ..., null, null, 6eed3c38a44db9428d1b09ac9e4333c6ad42918f4872e80d037af2cbd3aed271, null).
I understand German, don't worry :-)
Check also dmsf_file_revisions
table:
Table "public.dmsf_file_revisions"
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------------------------+-----------------------------+-----------+----------+-------------------------------------------------+----------+-------------+--------------+-------------
id | integer | | not null | nextval('dmsf_file_revisions_id_seq'::regclass) | plain | | |
BTW, you had an exact problem in #1422. So, check this issue and follow the same steps to fix it.
unfortunately it doenst work this time like it worked on #1422
# \d dmsf_file_revision_accesses
Tabelle »public.dmsf_file_revision_accesses«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
-----------------------+-----------------------------+--------------+---------------+---------------------------------------------------------
id | integer | | not null | nextval('dmsf_file_revision_accesses_id_seq'::regclass)
dmsf_file_revision_id | integer | | not null |
action | integer | | not null | 0
user_id | integer | | not null |
created_at | timestamp without time zone | | not null |
updated_at | timestamp without time zone | | not null |
Indexe:
"dmsf_file_revision_accesses_pkey" PRIMARY KEY, btree (id)
"index_dmsf_file_revision_accesses_on_dmsf_file_revision_id" btree (dmsf_file_revision_id)
dmsf_file_revision_accesses_id_seq
sequence exists?
yes
FEHLER: Relation »dmsf_file_revision_accesses_id_seq« existiert bereits
The error is exactly the same as in dmsf_files
table. Check everything again. I also wonder why in dmsf_files
the error was in English while in dmsf_file_revisions
is in German...
ActiveRecord::NotNullViolation (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
ActiveRecord::NotNullViolation (PG::NotNullViolation: FEHLER: NULL-Wert in Spalte »id« verletzt Not-Null-Constraint
yes i noticed this as well.
i checked everything again. Error still the same:
I, [2023-08-09T09:43:17.080905 #363604] INFO -- : [d7707772-1574-4f31-be04-e912ba09601e] Parameters: {"utf8"=>"✓", "authenticity_token"=>"RL1Auhe/1D8QZp9C3x1ZqjAyZvlxjkCiuucRgp98ru6TdZTSLlyv+f/VuFLUWrOZDCYCJTDJzxMc1XM+hVzjaA==", "commited_files"=>{"0"=>{"disk_filename"=>"230809071527_Server.xlsx", "tempfile_path"=>"/data/redmine/redmine-5.0.5/files/2023/08/230809091523_Server.xlsx", "size"=>"10146", "mime_type"=>"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "digest"=>"6eed3c38a44db9428d1b09ac9e4333c6ad42918f4872e80d037af2cbd3aed271", "title"=>"Server", "name"=>"Server.xlsx", "description"=>"tssst", "version_major"=>"0", "version_minor"=>"1", "version_patch"=>"", "comment"=>""}}, "name"=>"9,91 KB", "commit"=>"Upload", "id"=>"atkis-gen"}
I, [2023-08-09T09:43:17.154904 #363604] INFO -- : [d7707772-1574-4f31-be04-e912ba09601e] Current user: eddie
(id=227)
I, [2023-08-09T09:43:17.168882 #363604] INFO -- : [d7707772-1574-4f31-be04-e912ba09601e] Completed 500 Internal Server Error in 88ms (ActiveRecord: 12.3ms | Allocations: 7264)
F, [2023-08-09T09:43:17.169539 #363604] FATAL -- : [d7707772-1574-4f31-be04-e912ba09601e]
[d7707772-1574-4f31-be04-e912ba09601e] ActiveRecord::NotNullViolation (PG::NotNullViolation: FEHLER: NULL-Wert in Spalte »id« verletzt Not-Null-Constraint
DETAIL: Fehlgeschlagene Zeile enthält (null, 1, null, Server.xlsx, 230809074317_1_Server.xlsx, 10146, application/vnd.openxmlformats-officedocument.spreadsheetml.shee..., Server, tssst, null, 0, 1, , 0, null, 227, 2023-08-09 09:43:17.167557, 2023-08-09 09:43:17.167557, null, null, null, null, null, 6eed3c38a44db9428d1b09ac9e4333c6ad42918f4872e80d037af2cbd3aed271, null).
):
[d7707772-1574-4f31-be04-e912ba09601e]
[d7707772-1574-4f31-be04-e912ba09601e] plugins/redmine_dmsf/app/helpers/dmsf_upload_helper.rb:99:in `block in commit_files_internal'
[d7707772-1574-4f31-be04-e912ba09601e] plugins/redmine_dmsf/app/helpers/dmsf_upload_helper.rb:30:in `commit_files_internal'
[d7707772-1574-4f31-be04-e912ba09601e] plugins/redmine_dmsf/app/controllers/dmsf_upload_controller.rb:127:in `commit_files_internal'
[d7707772-1574-4f31-be04-e912ba09601e] plugins/redmine_dmsf/app/controllers/dmsf_upload_controller.rb:86:in `commit_files'
[d7707772-1574-4f31-be04-e912ba09601e] lib/redmine/sudo_mode.rb:61:in `sudo_mode'
I'd try to enter the row into the table manually using psql to see whether it works or not.
INSERT INTO dmsf_file_revisions VALUES(NULL, 1, ...);
like this ? but NULL isnt working due to the not null constraint
redmine_production=# INSERT INTO dmsf_file_revisions VALUES(NULL, 1, 4376);
FEHLER: NULL-Wert in Spalte »id« verletzt Not-Null-Constraint
DETAIL: Fehlgeschlagene Zeile enthält (null, 1, 4376, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, , null).
Then you have to specify column names too:
INSERT INTO dmsf_file_revisions(dmsf_file_id,...) VALUES(1, ...);
like this ?
redmine_production=# INSERT INTO dmsf_file_revision_accesses (dmsf_file_revision_id, action, user_id, created_at, updated_at) VALUES (3838, 0, 227, now(), now());
INSERT 0 1
unfortunately it doenst work this time like it worked on #1422
# \d dmsf_file_revision_accesses
The error is related dmsf_file_revisions
table not dmsf_file_revision_access
. Check it again.
ahhhh ok dmsf_file_revisions looks like this
\d dmsf_file_revisions
Tabelle »public.dmsf_file_revisions«
Spalte | Typ | Sortierfolge | NULL erlaubt? | Vorgabewert
-----------------------------------+-----------------------------+--------------+---------------+-----------------------
id | integer | | not null |
would this work ?
SELECT setval('dmsf_file_revisions_id_seq', (SELECT MAX(id) FROM dmsf_file_revisions));
Add a sequence for id
column of dmsf_file_revisions
table the same way as for dmsf_files
table. It should look like this:
Column | Type | Collation | Nullable | Default | Storage | Compression | Stats target | Description
-----------------------------------+-----------------------------+-----------+----------+-------------------------------------------------+----------+-------------+--------------+-------------
id | integer | | not null | nextval('dmsf_file_revisions_id_seq'::regclass) | plain | | |
oh yes, that worked
ALTER TABLE dmsf_file_revisions ALTER COLUMN id SET DEFAULT nextval('dmsf_file_revisions_id_seq'::regclass);
GRANT USAGE, SELECT ON SEQUENCE dmsf_file_revisions_id_seq TO redmine;
thank you very much
hey there,
i updated an old redmine version 3.4 to 5.0.5. Unfortunately i got a problem with the DMSF Plugin. When im trying to upload something i get this error: Internal error
An error occurred on the page you were trying to access. If you continue to experience problems please contact your Redmine administrator for assistance.
If you are the Redmine administrator, check your log files for details about the error.
When i´m looking into the production log i can find this piece:
ActiveRecord::NotNullViolation (PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint DETAIL: Failing row contains (null, 136, null,..
how can i solve this problem? we really need the plugin.
this is how the dmsf_files table:
id | integer | | not null | project_id | integer | | not null | dmsf_folder_id | integer | | | name | character varying | | not null | notification | boolean | | | false deleted | integer | | not null | 0 deleted_by_user_id | integer | | | created_at | timestamp without time zone | | not null | updated_at | timestamp without time zone | | not null | Indexe: "dmsf_files_pkey" PRIMARY KEY, btree (id) "index_dmsf_files_on_dmsf_folder_id" btree (dmsf_folder_id) "index_dmsf_files_on_project_id" btree (project_id)