~ubuntu-branches/ubuntu/maverick/eucalyptus/maverick

« back to all changes in this revision

Viewing changes to debian/patches/17-fix_walrus_OOM_errors.patch

  • Committer: Bazaar Package Importer
  • Author(s): Dave Walker (Daviey)
  • Date: 2010-07-21 17:27:10 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20100721172710-7xv07dmdqgivc3t9
Tags: 2.0~bzr1211-0ubuntu1
* New major upstream version merge, 2.0 (r1211).
* debian/patches/:
  - 01-wsdl-stubs.patch, debian/wsdl.md5sums: wsdl stubs updated.
  - 02-Makefile.patch: Updated to reflect new code layout.
  - 07-local_support_euca_conf-in.patch: Updated to reflect new code layout.
  - 08-ubuntu-default-networking.patch: Refreshed.
  - 09-small-128-192MB.patch: Updated to point to new location.
  - 10-disable-iscsi.patch: Refreshed.
  - 11-state-cleanup-memleakfix.patch: Removed, fixed upstream.
  - 15-fix-default-ramdisk.patch: Updated to point to new location.
  - 16-kvm_libvirt_xml_default_use_kvm.patch: Updated to reflect changes.
  - 17-fix_walrus_OOM_errors.patch: Removed, fixed upstream.
  - 18-priv_security.patch: Updated to reflect upstream changes.
  - 20-brute-force-webui.patch: Updated to reflect upstream changes. 
  - 21-eucalyptus-1.7-with-gwt-1.6.4.patch: New patch, allows 
    eucalyptus-1.7 to be built against gwt 1.6.4. Based on patch courtesy 
    of Dmitrii Zagorodnov, upstream. (LP: #597330)
* debian/eucalyptus-java-common.links: 
  - Changed symlink for groovy, point to groovy.all.jar, making compatiable 
    with groovy versions >1.7. (LP: #595421)
  - Added ant.jar & jetty-rewrite-handler.jar as they are now required.
* debian/control
  - & debian/build-jars: Added libjavassist-java and libjetty-extra-java as 
    build dependencies.
  - Added libjetty-extra-java as a dependency of eucalyptus-java-common
* The binary resulting jar's have been renamed from eucalyptus-*-1.6.2.jar
  to eucalyptus-*-main.jar:    
  - debian/eucalyptus-cc.upstart
  - debian/eucalyptus-cloud.install
  - debian/eucalyptus-common.eucalyptus.upstart
  - debian/eucalyptus-java-common.install
  - debian/eucalyptus-network.upstart
  - debian/eucalyptus-sc.install
  - debian/eucalyptus-walrus.install
* debian/eucalyptus-java-common.install: New upstream jars that have been
  installed:
  - eucalyptus-db-hsqldb-ext-main.jar
  - eucalyptus-component-main.jar
* debian/control:
  - Updated Standards Version to 3.8.4 (no change)
  - Updated the upstream Homepage to: http://open.eucalyptus.com/
  - Changed Vcs-Bzr to reflect new location of Ubuntu hosted development branch.
  - Made the Build Dependency of groovy and the binary eucalyptus-java-common
    package depend on version >=1.7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
Description: Fixes Walrus OOM errors.
2
 
Origin: Manually generated from diff of Ubuntu 1.6.2 branch and upstream
3
 
Bug: https://launchpad.net/bugs/565101
4
 
--- a/clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java
5
 
+++ b/clc/modules/walrus/src/main/java/edu/ucsb/eucalyptus/cloud/ws/WalrusManager.java
6
 
@@ -620,6 +620,28 @@
7
 
                                        long size = 0;
8
 
                                        FileIO fileIO = null;
9
 
                                        while ((dataMessage = putQueue.take())!=null) {
10
 
+                                               if(putQueue.getInterrupted()) {
11
 
+
12
 
+                                                       if(WalrusDataMessage.isEOF(dataMessage)) {
13
 
+                                                               WalrusMonitor monitor = messenger.getMonitor(key);
14
 
+                                                               if(monitor.getLastModified() == null) {
15
 
+                                                                       synchronized (monitor) {
16
 
+                                                                               monitor.wait();
17
 
+                                                                       }
18
 
+                                                               }
19
 
+                                                               lastModified = monitor.getLastModified();
20
 
+                                                               md5 = monitor.getMd5();
21
 
+                                                               //ok we are done here
22
 
+                                                               if(fileIO != null)
23
 
+                                                                       fileIO.finish();
24
 
+                                                               ObjectDeleter objectDeleter = new ObjectDeleter(bucketName, tempObjectName, -1L);
25
 
+                                                               objectDeleter.start();
26
 
+                                                               LOG.info("Transfer interrupted: "+ key);
27
 
+                                                               messenger.removeQueue(key, randomKey);
28
 
+                                                               break;
29
 
+                                                       }
30
 
+                                                       continue;
31
 
+                                               }
32
 
                                                if(WalrusDataMessage.isStart(dataMessage)) {
33
 
                                                        tempObjectName = objectName + "." + Hashes.getRandom(12);
34
 
                                                        digest = Hashes.Digest.MD5.get();
35
 
@@ -631,95 +653,95 @@
36
 
                                                        }
37
 
                                                } else if(WalrusDataMessage.isEOF(dataMessage)) {
38
 
                                                        //commit object
39
 
-                                                       WalrusMonitor monitor = messenger.getMonitor(key);
40
 
-                                                       synchronized (monitor) {                                                                                                                        
41
 
-                                                               try {
42
 
-                                                                       if(fileIO != null)
43
 
-                                                                               fileIO.finish();
44
 
-                                                                       storageManager.renameObject(bucketName, tempObjectName, objectName);
45
 
-                                                               } catch (IOException ex) {
46
 
-                                                                       LOG.error(ex);
47
 
-                                                                       messenger.removeQueue(key, randomKey);
48
 
-                                                                       messenger.removeMonitor(key);
49
 
-                                                                       throw new EucalyptusCloudException(objectKey);
50
 
+                                                       try {
51
 
+                                                               if(fileIO != null)
52
 
+                                                                       fileIO.finish();
53
 
+                                                               storageManager.renameObject(bucketName, tempObjectName, objectName);
54
 
+                                                       } catch (IOException ex) {
55
 
+                                                               LOG.error(ex);
56
 
+                                                               messenger.removeQueue(key, randomKey);
57
 
+                                                               throw new EucalyptusCloudException(objectKey);
58
 
+                                                       }
59
 
+                                                       if(digest != null)
60
 
+                                                               md5 = Hashes.bytesToHex(digest.digest());
61
 
+                                                       lastModified = new Date();
62
 
+                                                       long oldObjectSize = 0L;
63
 
+                                                       dbObject = WalrusControl.getEntityWrapper();
64
 
+                                                       searchObject = new ObjectInfo(bucketName, objectKey);
65
 
+                                                       ObjectInfo foundObject;
66
 
+                                                       try {
67
 
+                                                               foundObject = dbObject.getUnique(searchObject);
68
 
+                                                               if (foundObject.canWriteACP(userId)) {
69
 
+                                                                       List<GrantInfo> grantInfos = new ArrayList<GrantInfo>();
70
 
+                                                                       foundObject.addGrants(userId, grantInfos,
71
 
+                                                                                       accessControlList);
72
 
+                                                                       foundObject.setGrants(grantInfos);
73
 
                                                                }
74
 
-                                                               if(digest != null)
75
 
-                                                                       md5 = Hashes.bytesToHex(digest.digest());
76
 
-                                                               lastModified = new Date();
77
 
-                                                               long oldObjectSize = 0L;
78
 
-                                                               dbObject = WalrusControl.getEntityWrapper();
79
 
-                                                               searchObject = new ObjectInfo(bucketName, objectKey);
80
 
-                                                               ObjectInfo foundObject;
81
 
-                                                               try {
82
 
-                                                                       foundObject = dbObject.getUnique(searchObject);
83
 
-                                                                       if (foundObject.canWriteACP(userId)) {
84
 
-                                                                               List<GrantInfo> grantInfos = new ArrayList<GrantInfo>();
85
 
-                                                                               foundObject.addGrants(userId, grantInfos,
86
 
-                                                                                               accessControlList);
87
 
-                                                                               foundObject.setGrants(grantInfos);
88
 
-                                                                       }
89
 
-                                                                       oldObjectSize = foundObject.getSize();
90
 
-                                                                       if(WalrusProperties.enableTorrents) {
91
 
-                                                                               EntityWrapper<TorrentInfo> dbTorrent = db.recast(TorrentInfo.class);
92
 
-                                                                               TorrentInfo torrentInfo = new TorrentInfo(bucketName, objectKey);
93
 
-                                                                               List<TorrentInfo> torrentInfos = dbTorrent.query(torrentInfo);
94
 
-                                                                               if(torrentInfos.size() > 0) {
95
 
-                                                                                       TorrentInfo foundTorrentInfo = torrentInfos.get(0);
96
 
-                                                                                       TorrentClient torrentClient = Torrents.getClient(bucketName + objectKey);
97
 
-                                                                                       if(torrentClient != null) {
98
 
-                                                                                               torrentClient.bye();
99
 
-                                                                                       }
100
 
-                                                                                       dbTorrent.delete(foundTorrentInfo);
101
 
+                                                               oldObjectSize = foundObject.getSize();
102
 
+                                                               if(WalrusProperties.enableTorrents) {
103
 
+                                                                       EntityWrapper<TorrentInfo> dbTorrent = db.recast(TorrentInfo.class);
104
 
+                                                                       TorrentInfo torrentInfo = new TorrentInfo(bucketName, objectKey);
105
 
+                                                                       List<TorrentInfo> torrentInfos = dbTorrent.query(torrentInfo);
106
 
+                                                                       if(torrentInfos.size() > 0) {
107
 
+                                                                               TorrentInfo foundTorrentInfo = torrentInfos.get(0);
108
 
+                                                                               TorrentClient torrentClient = Torrents.getClient(bucketName + objectKey);
109
 
+                                                                               if(torrentClient != null) {
110
 
+                                                                                       torrentClient.bye();
111
 
                                                                                }
112
 
-                                                                       } else {
113
 
-                                                                               LOG.warn("Bittorrent support has been disabled. Please check pre-requisites");
114
 
-                                                                       }
115
 
-                                                               } catch (EucalyptusCloudException ex) {
116
 
-                                                                       if(objectInfo != null) {
117
 
-                                                                               foundObject = objectInfo;
118
 
-                                                                       } else {
119
 
-                                                                               messenger.removeMonitor(key);
120
 
-                                                                               messenger.removeQueue(key, randomKey);
121
 
-                                                                               db.rollback();
122
 
-                                                                               throw new EucalyptusCloudException("Unable to update object: " + bucketName + "/" + objectKey);
123
 
+                                                                               dbTorrent.delete(foundTorrentInfo);
124
 
                                                                        }
125
 
+                                                               } else {
126
 
+                                                                       LOG.warn("Bittorrent support has been disabled. Please check pre-requisites");
127
 
                                                                }
128
 
-                                                               foundObject.setEtag(md5);
129
 
-                                                               foundObject.replaceMetaData(request.getMetaData());
130
 
-                                                               foundObject.setSize(size);
131
 
-                                                               foundObject.setLastModified(lastModified);
132
 
-                                                               foundObject.setStorageClass("STANDARD");
133
 
-                                                               foundObject.setContentType(request.getContentType());
134
 
-                                                               foundObject.setContentDisposition(request.getContentDisposition());
135
 
-                                                               reply.setSize(size);
136
 
-                                                               if(WalrusProperties.shouldEnforceUsageLimits && !request.isAdministrator()) {
137
 
-                                                                       Long bucketSize = bucket.getBucketSize();
138
 
-                                                                       long newSize = bucketSize - oldObjectSize + size;
139
 
-                                                                       if(newSize > WalrusProperties.MAX_BUCKET_SIZE) {
140
 
-                                                                               messenger.removeQueue(key, randomKey);
141
 
-                                                                               messenger.removeMonitor(key);
142
 
-                                                                               dbObject.rollback();
143
 
-                                                                               throw new EntityTooLargeException("Key", objectKey);
144
 
-                                                                       }
145
 
-                                                                       bucket.setBucketSize(newSize);
146
 
-                                                               }
147
 
-                                                               if(WalrusProperties.trackUsageStatistics) {
148
 
-                                                                       walrusStatistics.updateBytesIn(size);
149
 
-                                                                       walrusStatistics.updateSpaceUsed(size);
150
 
+                                                       } catch (EucalyptusCloudException ex) {
151
 
+                                                               if(objectInfo != null) {
152
 
+                                                                       foundObject = objectInfo;
153
 
+                                                               } else {
154
 
+                                                                       db.rollback();
155
 
+                                                                       throw new EucalyptusCloudException("Unable to update object: " + bucketName + "/" + objectKey);
156
 
                                                                }
157
 
-                                                               if(logData != null) {
158
 
-                                                                       logData.setObjectSize(size);
159
 
-                                                                       updateLogData(bucket, logData);
160
 
+                                                       }
161
 
+                                                       foundObject.setEtag(md5);
162
 
+                                                       foundObject.replaceMetaData(request.getMetaData());
163
 
+                                                       foundObject.setSize(size);
164
 
+                                                       foundObject.setLastModified(lastModified);
165
 
+                                                       foundObject.setStorageClass("STANDARD");
166
 
+                                                       foundObject.setContentType(request.getContentType());
167
 
+                                                       foundObject.setContentDisposition(request.getContentDisposition());
168
 
+                                                       reply.setSize(size);
169
 
+                                                       if(WalrusProperties.shouldEnforceUsageLimits && !request.isAdministrator()) {
170
 
+                                                               Long bucketSize = bucket.getBucketSize();
171
 
+                                                               long newSize = bucketSize - oldObjectSize + size;
172
 
+                                                               if(newSize > WalrusProperties.MAX_BUCKET_SIZE) {
173
 
+                                                                       messenger.removeQueue(key, randomKey);
174
 
+                                                                       dbObject.rollback();
175
 
+                                                                       throw new EntityTooLargeException("Key", objectKey);
176
 
                                                                }
177
 
-                                                               if(objectInfo != null)
178
 
-                                                                       dbObject.add(foundObject);
179
 
-                                                               dbObject.commit();
180
 
+                                                               bucket.setBucketSize(newSize);
181
 
                                                        }
182
 
-                                                       messenger.removeQueue(key, randomKey);
183
 
-                                                       messenger.removeMonitor(key);
184
 
+                                                       if(WalrusProperties.trackUsageStatistics) {
185
 
+                                                               walrusStatistics.updateBytesIn(size);
186
 
+                                                               walrusStatistics.updateSpaceUsed(size);
187
 
+                                                       }
188
 
+                                                       if(logData != null) {
189
 
+                                                               logData.setObjectSize(size);
190
 
+                                                               updateLogData(bucket, logData);
191
 
+                                                       }
192
 
+                                                       if(objectInfo != null)
193
 
+                                                               dbObject.add(foundObject);
194
 
+                                                       dbObject.commit();
195
 
                                                        if(logData != null) {
196
 
                                                                logData.setTurnAroundTime(Long.parseLong(new String(dataMessage.getPayload())));
197
 
                                                        }
198
 
+
199
 
+                                                       //restart all interrupted puts
200
 
+                                                       WalrusMonitor monitor = messenger.getMonitor(key);
201
 
+                                                       synchronized (monitor) {
202
 
+                                                               monitor.setLastModified(lastModified);
203
 
+                                                               monitor.setMd5(md5);
204
 
+                                                               monitor.notifyAll();
205
 
+                                                       }
206
 
+                                                       messenger.removeQueue(key, randomKey);
207
 
                                                        LOG.info("Transfer complete: " + key);
208
 
                                                        break;
209
 
                                                } else {