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

Error when update zero size file through Webdav or CLI. #24042

Closed
Tracked by #22540
EdgarPsda opened this issue Feb 6, 2023 · 7 comments · Fixed by #30105
Closed
Tracked by #22540

Error when update zero size file through Webdav or CLI. #24042

EdgarPsda opened this issue Feb 6, 2023 · 7 comments · Fixed by #30105

Comments

@EdgarPsda
Copy link

EdgarPsda commented Feb 6, 2023

Problem Statement

When try to update a zero size file through webdav an error appears, this error is related with a
fk_contentlet_version_info_working value.

Steps to Reproduce

Windows commands:

Create zero size file

type nul > zero-size.file

Create non-zero size file

echo not empty > non-zero-size.file

Check the file sizes

dir *.file

Upload non-zero size file with webdav using curl

curl --verbose --user "[email protected]:admin" -T ".\non-zero-size.file" https://demo.dotcms.com/webdav/live/1/demo.dotcms.com/test-file.vtl

Upload zero size file with webdav using curl

curl --verbose --user "[email protected]:admin" -T ".\zero-size.file" https://demo.dotcms.com/webdav/live/1/demo.dotcms.com/test-file.vtl

Linux commands:

Create zero size file

touch zero-size.file

Create non-zero size file
echo not empty > non-zero-size.file

Check the file sizes

ls *.file -al

Upload non-zero size file with webdav using curl

curl --verbose --user '[email protected]:admin' -T './non-zero-size.file' https://demo.dotcms.com/webdav/live/1/demo.dotcms.com/test-file.vtl

Upload zero size file with webdav using curl
curl --verbose --user '[email protected]:admin' -T './zero-size.file' https://demo.dotcms.com/webdav/live/1/demo.dotcms.com/test-file.vtl

Following error message appears when upload/update zero size file:

[06/02/23 16:37:51:138 UTC] WARN webdav.HostResourceImpl: An error occurred while creating new file: test-file.vtl in this path: /webdav/live/1/default/ ERROR: update or delete on table "contentlet" violates foreign key constraint "fk_contentlet_version_info_working" on table "contentlet_version_info"
Detail: Key (inode)=(3a5ebb93-7dd8-4898-bb30-3fb959d5b222) is still referenced from table "contentlet_version_info".{
"SQL": ["delete from contentlet where inode=?"],
"maxRows": [-1],
"offest": [0],
"params": "3a5ebb93-7dd8-4898-bb30-3fb959d5b222"
}
com.dotmarketing.exception.DotDataException: ERROR: update or delete on table "contentlet" violates foreign key constraint "fk_contentlet_version_info_working" on table "contentlet_version_info"
Detail: Key (inode)=(3a5ebb93-7dd8-4898-bb30-3fb959d5b222) is still referenced from table "contentlet_version_info".{
"SQL": ["delete from contentlet where inode=?"],
"maxRows": [-1],
"offest": [0],
"params": "3a5ebb93-7dd8-4898-bb30-3fb959d5b222"
}
at com.dotmarketing.common.db.DotConnect.loadResult(DotConnect.java:273) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentFactoryImpl.delete(ESContentFactoryImpl.java:603) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentFactoryImpl.deleteVersion(ESContentFactoryImpl.java:766) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.deleteVersion_aroundBody88(ESContentletAPIImpl.java:2870) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl$AjcClosure89.run(ESContentletAPIImpl.java:1) ~[dotcms_22.03.2_999999.jar:?]
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) ~[aspectjrt-1.9.2.jar:?]
at com.dotcms.aspects.aspectj.AspectJDelegateMethodInvocation.proceed(AspectJDelegateMethodInvocation.java:42) ~[dotcms_22.03.2_999999.jar:?]
at com.dotmarketing.db.LocalTransaction.wrapReturnWithListeners(LocalTransaction.java:119) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.aspects.interceptors.WrapInTransactionMethodInterceptor.invoke(WrapInTransactionMethodInterceptor.java:30) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.aspects.aspectj.WrapInTransactionAspect.invoke(WrapInTransactionAspect.java:41) ~[dotcms_22.03.2_999999.jar:?]
at com.dotcms.content.elasticsearch.business.ESContentletAPIImpl.deleteVersion(ESContentletAPIImpl.java:2856) ~[dotcms_22.03.2_999999.jar:?]
at com.dotmarketing.portlets.contentlet.business.ContentletAPIInterceptor.deleteVersion(ContentletAPIInterceptor.java:2362) ~[dotcms_22.03.2_999999.jar:?]
at com.dotmarketing.webdav.DotWebdavHelper.setResourceContent(DotWebdavHelper.java:849) ~[dotcms_22.03.2_999999.jar:?]

Screenshot 2023-02-06 at 8 37 09 AM
Screenshot 2023-02-06 at 8 37 27 AM

Acceptance Criteria

In both cases (zero file size or non-zero file size) the file can be updated/upload and it's showing good results in backend dashboard, but those error messages still in the system logs.

dotCMS Version

This was tested locally with 22.03.2 version and demo site 23.01.

Proposed Objective

Application Performance

Proposed Priority

Priority 3 - Average

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

https://dotcms.zendesk.com/agent/tickets/109728

Assumptions & Initiation Needs

No response

Sub-Tasks & Estimates

No response

@EdgarPsda EdgarPsda changed the title Error when update zero size file through Webdav. Error when update zero size file through Webdav or CLI. Feb 6, 2023
@erickgonzalez erickgonzalez added the OKR : Customer Support Owned by Scott label Feb 6, 2023
@damen-dotcms damen-dotcms moved this from New to Future in dotCMS - Product Planning Mar 8, 2023
@nollymar
Copy link
Contributor

@wezell should webdav consider the property CONTENT_ALLOW_ZERO_LENGTH_FILES ?

@wezell
Copy link
Contributor

wezell commented Apr 25, 2023

Many of our installs set CONTENT_ALLOW_ZERO_LENGTH_FILES to true. If you set this parameter to true does webdav work as expected? If so, this is not a bug. It might be that we want to update our default value but we don't need to change code if it works as expected.

@nollymar
Copy link
Contributor

@EdgarPsda could you please check what Will said?

@EdgarPsda
Copy link
Author

Ok guys, I will do my test locally.

@EdgarPsda
Copy link
Author

@nollymar actually I'm able to upload/update zero file size, the only thing here is that the error message comes when you hit the action.

@nollymar nollymar moved this from Future to Next 1-3 Sprints in dotCMS - Product Planning Oct 9, 2023
@erickgonzalez erickgonzalez removed the OKR : Customer Support Owned by Scott label Mar 25, 2024
@fmontes fmontes moved this from Next 1-3 Sprints to Gardening Day Backlog in dotCMS - Product Planning Jul 8, 2024
@jgambarios jgambarios self-assigned this Sep 20, 2024
@jgambarios jgambarios moved this from Gardening Day Backlog to In Progress in dotCMS - Product Planning Sep 20, 2024
jgambarios added a commit that referenced this issue Sep 20, 2024
Introduced a new unit test to ensure publishing an existing file with empty content does not fail. Also, updated `DotWebdavHelper` to prevent deletion of the current version of contentlets during cleanup.
@jgambarios jgambarios moved this from In Progress to In Review in dotCMS - Product Planning Sep 20, 2024
@github-project-automation github-project-automation bot moved this from In Review to Internal QA in dotCMS - Product Planning Sep 24, 2024
@jgambarios jgambarios reopened this Sep 24, 2024
@github-project-automation github-project-automation bot moved this from Internal QA to Current Sprint Backlog in dotCMS - Product Planning Sep 24, 2024
@jgambarios jgambarios moved this from Current Sprint Backlog to Internal QA in dotCMS - Product Planning Sep 24, 2024
@jgambarios jgambarios removed their assignment Sep 24, 2024
@dcolina dcolina self-assigned this Sep 25, 2024
@dcolina
Copy link
Contributor

dcolina commented Sep 26, 2024

Internal QA: Passed.

The issue couldn't be reproduced anymore. It was tested using the docker image dotcms/dotcms:trunk_b69a711.

Screen.Recording.2024-09-26.at.15.41.53-480.mov

@dcolina dcolina closed this as completed Sep 26, 2024
@dcolina dcolina removed their assignment Sep 26, 2024
@dcolina dcolina moved this from Internal QA to QA - Backlog in dotCMS - Product Planning Sep 26, 2024
@bryanboza
Copy link
Contributor

Fixed, tested on trunk // Docker // FF
Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

9 participants