Re: [xwiki-users] Bug : unable to delete attached files in virtual wikis

2009-03-07 Thread Niels Mayer
I had a similar problem, with attachments not being deletable, which also
prevented the document itself from being deleted. Unfortunately, this also
suggested an additional issue arising with attachments. If a user makes
large attachments to their user-document, e.g. XWiki.MyName then even in a
closed wiki that only allows users to edit their own user document, they
can cause a denial of service attack through large attachments. In other
words, even if the wiki is setup so that regular registered XWikiAllGroup
users don't have write access to any directory, just comment-access to
documents; they'll still have write access to their own XWiki.MyName
document created through registration... and that means they'll be able to
add attachments even when you think they couldn't. The Rights
adminstration checkbox Prevent unregistered users from editing pages,
regardless of the page or space rights doesn't prevent attachments from
being added to user's own pages.

Anyways, I ended up solving the blowups and OOM errors by deleting the
attachments directly in the database:

mysql select XWA_ID,XWA_DOC_ID,XWA_FILENAME,XWA_SIZE,XWA_AUTHOR from
xwikiattachment where XWA_AUTHOR='XWiki.JG';

| XWA_ID  | XWA_DOC_ID | XWA_FILENAME | XWA_SIZE | XWA_AUTHOR|
|  1185703559 |  168880978 | foo.pdf  |  9817587 | XWiki.JG  |
|  -352107721 |  168880978 | bar.pdf  | 13049680 | XWiki.JG  |
|  1527849923 |  168880978 | baz.pdf  |  293 | XWiki.JG  |
| -2073884056 |  168880978 | frop.pdf |  5904061 | XWiki.JG  |
|  1039500510 |  168880978 | schlop.pdf   |  4440028 | XWiki.JG  |
|   942569068 |  168880978 | plop.pdf | 14033466 | XWiki.JG  |
|  1363529635 |  168880978 | schnops.pdf  |0 | XWiki.JG  |
| -1054875919 |  168880978 | hops.jpg | 3081 | XWiki.JG  |

8 rows in set (0.00 sec)

mysql delete from xwikiattachment where XWA_AUTHOR='XWiki.JG';
Query OK, 8 rows affected (0.00 sec)

Someone please tell me if this is not the right way to fix such issues...

As afterthought, I realized that setting
xwiki.store.attachment.versioning.hint=void in xwiki.cfg might prevent xwiki
from reading/diffing and attempting to version a large attachment. Doing so
could certainly make it run out of memory, and changing this option might
prevent the bug?:

#-# The attachment versioning storage. Use 'void' to disable attachment
versioning.
# xwiki.store.attachment.versioning.hint=default

Also, perhaps by not sending deleted attachments to the recycle bin, it
won't need to be copied anywhere, and therefore there'll not be any memory
to run out copying a giant attachment through java (assuming that's what
happens on delete).

#-# The attachment recycle bin storage.
# xwiki.store.attachment.recyclebin.hint=default

Niels
http://nielsmayer.com

PS: perhaps the defaults for xwiki.store.attachment.versioning.hint and
xwiki.store.attachment.recyclebin.hint need to be changed?


On Fri, Mar 6, 2009 at 2:37 AM, PERINAUD Christophe 
christophe.perin...@kbl-bank.com wrote:

 Hello (again)

 All is ok in the main wiki but in a virtual wiki i can't delete an attached
 file of a page. After the confirmation message i got :

 A problem occured while trying to service your request. Please contact the
 support if this happens again.

 Detailed information:

Error number 0 in 3: Exception while hibernate execute
 Wrapped Exception: could not get next sequence value
 com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while
 hibernate execute
 Wrapped Exception: could not get next sequence value
at
 com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1052)
at
 com.xpn.xwiki.store.XWikiHibernateBaseStore.executeWrite(XWikiHibernateBaseStore.java:1098)
at
 com.xpn.xwiki.store.hibernate.HibernateAttachmentRecycleBinStore.saveToRecycleBin(HibernateAttachmentRecycleBinStore.java:83)
at
 com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:2799)
at
 com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:2782)
at
 com.xpn.xwiki.web.DeleteAttachmentAction.action(DeleteAttachmentAction.java:72)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:215)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at
 org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at
 org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at
 org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at
 org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
   

[xwiki-users] Bug : unable to delete attached files in virtual wikis

2009-03-06 Thread PERINAUD Christophe
Hello (again)

All is ok in the main wiki but in a virtual wiki i can't delete an attached 
file of a page. After the confirmation message i got :

A problem occured while trying to service your request. Please contact the 
support if this happens again. 

Detailed information:

Error number 0 in 3: Exception while hibernate execute
Wrapped Exception: could not get next sequence value
com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception while hibernate 
execute
Wrapped Exception: could not get next sequence value
at 
com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1052)
at 
com.xpn.xwiki.store.XWikiHibernateBaseStore.executeWrite(XWikiHibernateBaseStore.java:1098)
at 
com.xpn.xwiki.store.hibernate.HibernateAttachmentRecycleBinStore.saveToRecycleBin(HibernateAttachmentRecycleBinStore.java:83)
at 
com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:2799)
at 
com.xpn.xwiki.doc.XWikiDocument.deleteAttachment(XWikiDocument.java:2782)
at 
com.xpn.xwiki.web.DeleteAttachmentAction.action(DeleteAttachmentAction.java:72)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:215)
at com.xpn.xwiki.web.XWikiAction.execute(XWikiAction.java:115)
at 
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at 
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at 
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:596)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at 
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:830)
at 
com.xpn.xwiki.plugin.webdav.XWikiDavFilter.doFilter(XWikiDavFilter.java:68)
at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at 
com.xpn.xwiki.wysiwyg.server.filter.ConversionFilter.doFilter(ConversionFilter.java:135)
at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at 
com.xpn.xwiki.web.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:287)
at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at 
com.xpn.xwiki.web.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:112)
at 
org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:821)
at 
org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler.java:471)
at 
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:568)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1565)
at 
org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.java:633)
at org.mortbay.http.HttpContext.handle(HttpContext.java:1517)
at org.mortbay.http.HttpServer.service(HttpServer.java:954)
at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:983)
at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
at 
org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)


Wrapped Exception:

java.sql.SQLException: ORA-02289: sequence does not exist

at 
oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
at 
oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
at 
oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
at 
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
at 
oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
at 
oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
at 
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
at 
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
at 
oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3431)
at