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

File Hook fails when repository is new - blocker #33

Closed
ghost opened this issue Nov 10, 2017 · 1 comment
Closed

File Hook fails when repository is new - blocker #33

ghost opened this issue Nov 10, 2017 · 1 comment
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Nov 10, 2017

Hello,

I have updated Bitbucket to version 5.4.1 and updated File Hook to version 3.0.0.

I create a new repository and I activate the File Size Hook with regex

Include: .*
Size: 4096

I do a touch test for an empty file

git clone
git add --all
git commit -m "asd"
git push origin

the push fails and the bitbucket log shows:

2017-11-10 10:43:42,271 INFO  [threadpool:thread-2] brian @1EE93X5x643x7473x0 1eoaj33 10.XX.XX.XX "POST /scm/test/test.git/git-receive-pack HTTP/1.1" c.a.s.i.h.r.DefaultRepositoryHookService [TEST/test[703]] hook 'filesize-hook' vetoed the push request
2017-11-10 10:43:42,273 WARN  [threadpool:thread-2]  c.a.s.i.hook.DefaultHookService Hook socket I/O failed before the repository/hook could be identified
org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-only
        at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
        at com.atlassian.stash.internal.hook.DefaultBuiltInHookHandlerFactory.lambda$preReceive$0(DefaultBuiltInHookHandlerFactory.java:36)
        at com.atlassian.stash.internal.hook.DefaultHookService.doHandleRequest(DefaultHookService.java:303)
        at com.atlassian.stash.internal.hook.DefaultHookService.handleRequest(DefaultHookService.java:289)
        at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:230)
        at com.atlassian.stash.internal.hook.DefaultHookService$1.lambda$run$0(DefaultHookService.java:197)
        at com.atlassian.stash.internal.concurrent.DefaultTransferableStateManager$StateTransferringRunnable.run(DefaultTransferableStateManager.java:166)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.lang.Thread.run(Thread.java:748)
        ... 11 frames trimmed

I disable the file hook, I push and it works.

I reactivate the plugin, I do a new commit and it works again.

I saw someone had the same issue:
https://community.atlassian.com/t5/Product-Apps-discussions/Unable-to-push-branch-created-locally-when-File-Hooks-plugin-is/td-p/612681

and he modified the code to:

if (refChange.getFromHash().equals("0000000000000000000000000000000000000000")) { request = new CommitsBetweenRequest.Builder(repository) .include(refChange.getToHash()) .build(); } else { request = new CommitsBetweenRequest.Builder(repositoryHookRequest.getRepository()) .exclude(refChange.getFromHash()) .include(refChange.getToHash()) .build(); }

Regards

@christiangalsterer christiangalsterer added this to the 3.0.1 milestone Nov 12, 2017
@christiangalsterer
Copy link
Owner

New release 3.0.1 is now available

raspy added a commit to raspy/stash-filehooks-plugin that referenced this issue Jan 29, 2018
Bitbucket 5.x does not like excluding null SHA1 commit which is used on
ADD ref changes. This was previously reported as christiangalsterer#33, but got lost in
refactoring.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant