sgx_rijndael128GCM_encrypt does not encrypt - aes

I am trying to use sgx_rijndael128GCM_encrypt to encrypt some data but the buffer remains empaty. I dont know why or what i am doing wrong. This is the code I am using, if there is any errors please mention them. As far as I think, there will be some changes in line 2, where i am calculating aesgcm_len or maybe i am using the wrong key. But if the key is wrong then it should show some errors. Please guide me. Thank you in advance.
uint8_t *plaintext = (uint8_t *)item->certificate;
size_t aesgcm_len =4 + ((((double)sizee)/16))*16 +16;
item->encrypteee = (uint8_t*)malloc(aesgcm_len);
sgx_aes_gcm_128bit_tag_t mac;
const sgx_aes_gcm_128bit_key_t aes_key= { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf };
//sgx_read_rand((unsigned char *) &aes_key, sizeof(sgx_aes_gcm_128bit_key_t));
uint8_t iv[12];
memset(iv,0,12);
((int*)item->encrypteee)[0]=sizee;
sgx_status_t res;
res= sgx_rijndael128GCM_encrypt(&aes_key, plaintext, sizee, (uint8_t*)item->encrypteee+4,iv,12 ,NULL,0,&mac);
if (res != SGX_SUCCESS) {
//printf("encryption error");
free(wallet);
return ERR_FAIL_UNSEAL;
}

Related

Error on begin transaction in go-pg v9.2.0

I have updated go-pg lib from v9.0.3 to v9.2.0.
Getting error:
panic: not reached [recovered]
panic: not reached
/usr/local/go/src/runtime/panic.go:969 +0x175
github.com/go-pg/pg/v9/internal/pool.(*SingleConnPool).SetConn(...)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/internal/pool/pool_single.go:61
github.com/go-pg/pg/v9.(*baseDB).initConn(0xc0002440f0, 0x1efb500, 0xc00019e008, 0xc000292550, 0x0, 0x0)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/base.go:115 +0x585
github.com/go-pg/pg/v9.(*baseDB).getConn(0xc0002440f0, 0x1efb500, 0xc00019e008, 0x0, 0x0, 0x0)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/base.go:79 +0x90
github.com/go-pg/pg/v9.(*baseDB).withConn(0xc0002440f0, 0x1efb500, 0xc00019e008, 0xc000813c00, 0x0, 0x0)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/base.go:133 +0x7c
github.com/go-pg/pg/v9.(*Tx).withConn(...)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/tx.go:96
github.com/go-pg/pg/v9.(*Tx).exec(0xc00072c980, 0x1efb500, 0xc00019e008, 0x1bd4d20, 0x1ec3250, 0x0, 0x0, 0x0, 0x8, 0xc000078cd0, ...)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/tx.go:149 +0x1f0
github.com/go-pg/pg/v9.(*Tx).ExecContext(...)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/tx.go:139
github.com/go-pg/pg/v9.(*Tx).begin(0xc00072c980, 0x1efb500, 0xc00019e008, 0x4b2, 0x0)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/tx.go:339 +0xb6
github.com/go-pg/pg/v9.(*baseDB).Begin(0xc000244000, 0x25f0b4e, 0x24, 0xc000589ea0)
/Users/sanches1984/go/src/github.com/sanches1984/statclass/vendor/github.com/go-pg/pg/v9/tx.go:53 +0x1ca
github.com/sanches1984/gopkg-database.(*dbWrapper).StartTransaction(0xc0007180c0, 0x0, 0x25f0b4e, 0x24, 0xc0000003f3)
Fail on:
tx, err := conn.Begin()
Found that they fix it here, but it doesn't work. What's the problem?
Check first if this is linked to go-pg/pg issue 1687, which is supposed to be resolved in PR 1688.
That PR is only available in v10.0.0-beta.9, so you would need to explicitly upgrade your dependency
go get github.com/go-pg/pg#v10.0.0-beta.14

Why this program which use BPF and RAW SOCKET just hangs?

GOAL: write a simple packet filter using BPF. The packet filter should allow you to choose the interface.
PROBLEM: if I uncomment the third to last instruction in the code (where there is a call to recvfrom, the execution just hangs and I can't see no output (neither "buffer zeroed" which I should be able to see in the stdout).
QUESTIONS: 1) how can I fix it? 2) why the programs hangs during the execution and doesn't show the first printf output? 3) how can I receive from ANY interface?
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <arpa/inet.h>
#include <linux/filter.h>
#include <linux/if_ether.h>
#include <linux/if_packet.h>
#include <net/if.h>
#define DEFAULT_IF "wlan0"
/* definisco programma bpf */
/* tcpdump -i lo icmp -dd */
struct sock_filter bpfcode[] = {
{ 0x28, 0, 0, 0x0000000c }, /* (000) ldh [12] */
{ 0x15, 0, 3, 0x00000800 }, /* (001) jeq #0x800 jt 2 jf 5 */
{ 0x30, 0, 0, 0x00000017 }, /* (002) ldb [23] */
{ 0x15, 0, 1, 0x00000001 }, /* (003) jeq #0x1 jt 4 jf 5 */
{ 0x6, 0, 0, 0x00040000 }, /* (004) ret #262144 */
{ 0x6, 0, 0, 0x00000000 }, /* (005) ret #0 */
};
int main(int argc, char *argv[])
{
struct sock_fprog bpf = {
sizeof(bpfcode) / sizeof(struct sock_filter),
bpfcode
};
socklen_t saddr_len = sizeof(struct sockaddr_ll);
struct sockaddr_ll addr;
unsigned char *buffer;
char ifname[IFNAMSIZ];
int ret, sfd, rval;
buffer = calloc(1, 65536);
if (!buffer) {
perror("calloc");
return -1;
}
// prendi nome interfaccia
if (argc > 1)
strcpy(ifname, argv[1]);
else
strcpy(ifname, DEFAULT_IF);
// creazione raw socket
sfd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
if (sfd < 0) {
perror("socket");
return -1;
}
// attacco filtro alla socket
ret = setsockopt(sfd, SOL_SOCKET, SO_ATTACH_FILTER, &bpf, sizeof(bpf));
if (ret < 0) {
perror("setsockopt");
exit(EXIT_FAILURE);
}
// quando si usa packet socket bisogna settare sll_protocol e
// sll_ifindex se si vuol fare il bind ad una specifica interfaccia
memset(&addr, 0, sizeof(addr));
addr.sll_family = AF_PACKET;
addr.sll_protocol = htons(ETH_P_ALL);
addr.sll_ifindex = if_nametoindex(ifname);
printf("index %d", addr.sll_ifindex);
// viene assegnato un indirizzo al socket
if (bind(sfd, (struct sockaddr *) &addr,
sizeof(struct sockaddr_ll)) == -1) {
perror("bind");
exit(EXIT_FAILURE);
}
// ricevo traffico
if (!buffer[0])
printf("buffer zeroed");
// rval = recvfrom(sfd, buffer, 65536, 0, (struct sockaddr *)&addr,
// &saddr_len);
if (buffer[0])
printf("something was written in the buffer");
return 0;
}
How do I fix it?
What do you want to fix exactly? See below.
Why the programs hangs during the execution and doesn't show the first printf output?
Both printf() do work, except you're not printing any line breaks ('\n') at the end of your messages, so the system does not flush your message to the console. Just end your messages with line breaks and you will see your messages as expected.
As for the hang, this is simply because recvfrom() waits until a packet arrives. Well, not just any packet in your case, since you are filtering on ICMP. Ping your interface from the outside, and the program should resume. Alternatively, for debugging your C program, just keep { 0x6, 0, 0, 0x00040000 } (return non-zero) in your BPF program, and any received packet should do.
How can I receive from ANY interface?
How to bind a socket to multiple interfaces

Receive UDP broadcast datagram in C

I have the following issue.
I need to send broadcast UDP datagram packet and a device that is connected to my local network should reply with another broadcast UDP datagram packet.
So the communication should be like this:
me -> 192.168.0.255 (or 255.255.255.255) : "Who is out there?"
my_device > 192.168.0.255: "It's me... IP:..."
Here a very important condition is that I should use always port 30303 as source and at the same time as a destination port. The devices on the other side can use a random port above 4000 for source port and 30303 port for the Destination port.
The problem is that with my code, I can send UDP broadcast, I can see with Wireshark, that the device answers my call, but I cant manage to make my program to receive the broadcast UDP packet.
here is my source:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <locale.h>
#include <fcntl.h>
#define DST_PORT 30303
#define SRC_PORT 30303
#define BUFLEN 84
#define IP "192.168.0.255"
int main(int argc, char *argv[]) {
struct sockaddr_in addr, srcaddr;
int fd;
unsigned char buf[BUFLEN];
unsigned char message[]={0x44, 0x69, 0x73, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x3a, 0x20, 0x57, 0x68, 0x6f, 0x20, 0x69, 0x73, 0x20, 0x6f, 0x75, 0x74, 0x20, 0x74, 0x68, 0x65, 0x72, 0x65, 0x3f, 0x00, 0x0a};
int broadcast=1;
if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("socket");
exit(1);
}
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = inet_addr(IP);
addr.sin_port = htons(DST_PORT);
memset(&srcaddr, 0, sizeof(srcaddr));
for(int i=0;i<BUFLEN;i++) buf[i]=0x00;
for(int i=0;i<BUFLEN;i++) printf("0x%x", buf[i]);
printf("\n\033[32mBUFFER CLEARED!\033[0m\n");
srcaddr.sin_family = AF_INET;
srcaddr.sin_addr.s_addr = htonl(INADDR_ANY);
srcaddr.sin_port = htons(SRC_PORT);
setsockopt(fd, SOL_SOCKET, SO_BROADCAST, &broadcast, sizeof(broadcast));
int slen = sizeof(addr);
if (bind(fd, (struct sockaddr *) &srcaddr, sizeof(srcaddr)) < 0) {
perror("bind");
exit(1);
}
/* connect(fd, (struct sockaddr *) &addr, sizeof(addr)); */
if (sendto(fd, message, strlen(message)+2 , 0 , (struct sockaddr *) &addr, sizeof(addr))==-1)
{
printf("\n\033[31mCouldnt send message!!!\033[0m\n");;
}
else printf("\n\033[32mDATAGRAM SENT!\033[0m\n");
puts("\nI am waiting for DGRAM\n");
slen=sizeof(rcvaddr);
//close(fd);
sleep(1);
//connect(fd, (struct sockaddr *) &addr, sizeof(addr));
recvfrom(fd, buf, BUFLEN, 0, (struct sockaddr *) &rcvaddr, &slen);
printf("Recieved!\n");
setlocale(LC_ALL, "");
char temp[4]="\0";
for (int i=0; i<BUFLEN;i++)
{
printf("0x%x ", buf[i]);
}
return 0;
}
What I'm trying to do is:
1. Create socket
2. Change source port to a fixed port number
3. Send UDP broadcast Datagram
4. Receive UDP broadcast Datagram
Unfortunately, I receive the datagram I have to send instead of the one, that my device sends.

Sending chunked files to save in mongodb

I have 2 different servers for example (Server 1 , Server 2), In the first server I have golang app which splits files and sending to second server which should save in mongodb via mgo.v2
Server 1:
func mainHandle(rw http.ResponseWriter, rq *http.Request) {
fileToBeChunked := "/Users/IT/Desktop/4k.jpg"
file, err := os.Open(fileToBeChunked)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
defer file.Close()
fileInfo, _ := file.Stat()
var fileSize int64 = fileInfo.Size()
const fileChunk = 0.25 * (1 << 20) // 1 MB, change this to your requirement
// calculate total number of parts the file will be chunked into
totalPartsNum := uint64(math.Ceil(float64(fileSize) / float64(fileChunk)))
fmt.Printf("Splitting to %d pieces.\n", totalPartsNum)
var sent int
prev_part := 0
for i := uint64(0); i < totalPartsNum; i++ {
partSize := int(math.Min(fileChunk, float64(fileSize-int64(i*fileChunk))))
sent = sent + partSize
partBuffer := make([]byte, partSize)
//fileBuffer := make([]byte, fileSize)
//fmt.Printf("File size is %d \n",fileBuffer)
fmt.Printf("Part size is %d \n",partSize)
file.Read(partBuffer)
client := &http.Client{}
req, _ := http.NewRequest("PUT", "http://localhost:8011/upload/23", bytes.NewReader(partBuffer))
req.Header.Set("Content-Range", "bytes "+strconv.Itoa(prev_part) + "-"+strconv.Itoa(sent-1)+"/"+strconv.FormatInt(fileSize,10))
req.Header.Set("Content-Length", strconv.Itoa(partSize))
res, _ := client.Do(req)
prev_part = sent
fmt.Println(res)
}
}
Server 2
func UploadFileChunk(rw http.ResponseWriter,rq *http.Request) {
fmt.Println(rq.Header["Content-Range"])
cnt_range:=rq.Header["Content-Range"]
file:=createFileByName("asd")
if(checkFileChunkIndex(cnt_range[0])) {
buf, err := ioutil.ReadAll(rq.Body)
if err!=nil {log.Fatal("request",err)}
file.Write(buf)
} else {
file.Close()
}
}
func checkFileChunkIndex(cnt_r string ) bool {
re := regexp.MustCompile(`([a-z]+) ([[:alnum:]]+)-([[:alnum:]]+)/([[:alnum:]]+)`)
component:= re.FindStringSubmatch(cnt_r)
filesize,_:= strconv.Atoi(component[4])
last_chunk,_:= strconv.Atoi(component[3])
return filesize - last_chunk - 1 > 0
}
func createFileByName(fname string ) *mgo.GridFile {
if(!file_created) {
_File,err:= db.GridFS("fs").Create("112233")
File = *_File
if err != nil {
panic(err)
}
file_created = true
return &File
}
return &File
}
For testing I have send a file with size 4mb, but after 3rd request , as a response I have got the following error
fatal error: sync: unlock of unlocked mutex
Here is the full error response
fatal error: sync: unlock of unlocked mutex
goroutine 7 [running]:
runtime.throw(0x144de3d, 0x1e)
/usr/local/go/src/runtime/panic.go:596 +0x95 fp=0xc42004b8c0 sp=0xc42004b8a0
sync.throw(0x144de3d, 0x1e)
/usr/local/go/src/runtime/panic.go:585 +0x35 fp=0xc42004b8e0 sp=0xc42004b8c0
sync.(*Mutex).Unlock(0xc4200ca8c0)
/usr/local/go/src/sync/mutex.go:113 +0xa4 fp=0xc42004b908 sp=0xc42004b8e0
sync.(*Cond).Wait(0x162c4e8)
/usr/local/go/src/sync/cond.go:56 +0x6c fp=0xc42004b938 sp=0xc42004b908
gopkg.in/mgo%2ev2.(*GridFile).insertChunk(0x162c4e0, 0xc42018a000, 0x3fc00, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:623 +0x1b3 fp=0xc42004ba48 sp=0xc42004b938
gopkg.in/mgo%2ev2.(*GridFile).Write(0x162c4e0, 0xc420678000, 0x40000, 0x7fe00, 0x40000, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:595 +0x2d6 fp=0xc42004baf0 sp=0xc42004ba48
go_storage/files.UploadFileChunk(0x15faf80, 0xc4202e4380, 0xc42000b000)
/Users/IT/go/src/go_storage/files/files.go:249 +0x23b fp=0xc42004bba8 sp=0xc42004baf0
net/http.HandlerFunc.ServeHTTP(0x1459710, 0x15faf80, 0xc4202e4380, 0xc42000b000)
/usr/local/go/src/net/http/server.go:1942 +0x44 fp=0xc42004bbd0 sp=0xc42004bba8
github.com/gorilla/mux.(*Router).ServeHTTP(0xc42001a320, 0x15faf80, 0xc4202e4380, 0xc42000b000)
/Users/IT/go/src/github.com/gorilla/mux/mux.go:114 +0x10c fp=0xc42004bcd0 sp=0xc42004bbd0
net/http.(*ServeMux).ServeHTTP(0x162bee0, 0x15faf80, 0xc4202e4380, 0xc42000ae00)
/usr/local/go/src/net/http/server.go:2238 +0x130 fp=0xc42004bd10 sp=0xc42004bcd0
net/http.serverHandler.ServeHTTP(0xc420096dc0, 0x15faf80, 0xc4202e4380, 0xc42000ae00)
/usr/local/go/src/net/http/server.go:2568 +0x92 fp=0xc42004bd58 sp=0xc42004bd10
net/http.(*conn).serve(0xc4200cd2c0, 0x15fb7c0, 0xc420016ac0)
/usr/local/go/src/net/http/server.go:1825 +0x612 fp=0xc42004bfc8 sp=0xc42004bd58
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2197 +0x1 fp=0xc42004bfd0 sp=0xc42004bfc8
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2668 +0x2ce
goroutine 1 [IO wait]:
net.runtime_pollWait(0x23a0e40, 0x72, 0x0)
/usr/local/go/src/runtime/netpoll.go:164 +0x59
net.(*pollDesc).wait(0xc4200556b8, 0x72, 0x0, 0xc4200bcee0)
/usr/local/go/src/net/fd_poll_runtime.go:75 +0x38
net.(*pollDesc).waitRead(0xc4200556b8, 0xffffffffffffffff, 0x0)
/usr/local/go/src/net/fd_poll_runtime.go:80 +0x34
net.(*netFD).accept(0xc420055650, 0x0, 0x15f6ec0, 0xc4200bcee0)
/usr/local/go/src/net/fd_unix.go:430 +0x1e5
net.(*TCPListener).accept(0xc42000e0a0, 0xc4200cd340, 0x13c96c0, 0xffffffffffffffff)
/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc42000e0a0, 0xc420049df0, 0xc420049df8, 0xc420049de8)
/usr/local/go/src/net/tcpsock.go:215 +0x49
net/http.tcpKeepAliveListener.Accept(0xc42000e0a0, 0x1459ca8, 0xc4200cd2c0, 0x15fb880, 0xc420019c80)
/usr/local/go/src/net/http/server.go:3044 +0x2f
net/http.(*Server).Serve(0xc420096dc0, 0x15fb280, 0xc42000e0a0, 0x0, 0x0)
/usr/local/go/src/net/http/server.go:2643 +0x228
net/http.(*Server).ListenAndServe(0xc420096dc0, 0xc420096dc0, 0x15f60c0)
/usr/local/go/src/net/http/server.go:2585 +0xb0
net/http.ListenAndServe(0x143fbf7, 0x5, 0x0, 0x0, 0xc420110360, 0xc420019230)
/usr/local/go/src/net/http/server.go:2787 +0x7f
main.main()
/Users/IT/go/src/go_storage/main.go:24 +0x358
goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:2197 +0x1
goroutine 5 [select]:
gopkg.in/mgo%2ev2.(*mongoCluster).syncServersLoop(0xc42000a800)
/Users/IT/go/src/gopkg.in/mgo.v2/cluster.go:394 +0x3a3
created by gopkg.in/mgo%2ev2.newCluster
/Users/IT/go/src/gopkg.in/mgo.v2/cluster.go:78 +0x188
goroutine 22 [semacquire]:
sync.runtime_SemacquireMutex(0xc4200f20e4)
/usr/local/go/src/runtime/sema.go:62 +0x34
sync.(*Mutex).Lock(0xc4200f20e0)
/usr/local/go/src/sync/mutex.go:87 +0x9d
gopkg.in/mgo%2ev2.(*mongoSocket).Acquire(0xc4200f20e0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:242 +0x31
gopkg.in/mgo%2ev2.(*Session).acquireSocket(0xc4200e04e0, 0x0, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4419 +0x475
gopkg.in/mgo%2ev2.(*Collection).writeOp(0xc420019f20, 0x139efa0, 0xc4200e8000, 0x100e501, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4603 +0xd6
gopkg.in/mgo%2ev2.(*Collection).Insert(0xc420019f20, 0xc420010070, 0x1, 0x1, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:2437 +0xac
gopkg.in/mgo%2ev2.(*GridFile).insertChunk.func1(0x162c4e0, 0xc42033c000, 0x3fc3e, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:642 +0xe8
created by gopkg.in/mgo%2ev2.(*GridFile).insertChunk
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:650 +0x460
goroutine 19 [sleep]:
time.Sleep(0x37e11d600)
/usr/local/go/src/runtime/time.go:59 +0xf9
gopkg.in/mgo%2ev2.(*mongoServer).pinger(0xc4200f2000, 0x1)
/Users/IT/go/src/gopkg.in/mgo.v2/server.go:301 +0x293
created by gopkg.in/mgo%2ev2.newServer
/Users/IT/go/src/gopkg.in/mgo.v2/server.go:89 +0x166
goroutine 21 [semacquire]:
sync.runtime_SemacquireMutex(0xc4200f20e4)
/usr/local/go/src/runtime/sema.go:62 +0x34
sync.(*Mutex).Lock(0xc4200f20e0)
/usr/local/go/src/sync/mutex.go:87 +0x9d
gopkg.in/mgo%2ev2.(*mongoSocket).readLoop(0xc4200f20e0)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:582 +0x40a
created by gopkg.in/mgo%2ev2.newSocket
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:194 +0x259
goroutine 9 [semacquire]:
sync.runtime_SemacquireMutex(0xc4202d2044)
/usr/local/go/src/runtime/sema.go:62 +0x34
sync.(*Mutex).Lock(0xc4202d2040)
/usr/local/go/src/sync/mutex.go:87 +0x9d
gopkg.in/mgo%2ev2.(*mongoSocket).SimpleQuery(0xc4200f20e0, 0xc4202e4000, 0x6, 0x143fbe3, 0x5, 0xc4202d2031, 0xb)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:367 +0x28b
gopkg.in/mgo%2ev2.(*Database).run(0xc4200bc8e0, 0xc4200f20e0, 0x13d0f00, 0xc4202d4040, 0x13cbb00, 0xc4202e2000, 0xc4200f2000, 0xc4200f20e0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:3261 +0x1b3
gopkg.in/mgo%2ev2.(*Collection).writeOpCommand(0xc420019f20, 0xc4200f20e0, 0xc4200e2000, 0x139efa0, 0xc4202d6000, 0x1010001, 0x23685a8, 0x0, 0x100c420028638)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4786 +0x1db
gopkg.in/mgo%2ev2.(*Collection).writeOp(0xc420019f20, 0x139efa0, 0xc4202d6000, 0x100e501, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4645 +0x6dc
gopkg.in/mgo%2ev2.(*Collection).Insert(0xc420019f20, 0xc4202d2000, 0x1, 0x1, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:2437 +0xac
gopkg.in/mgo%2ev2.(*GridFile).insertChunk.func1(0x162c4e0, 0xc420290000, 0x3fc3e, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:642 +0xe8
created by gopkg.in/mgo%2ev2.(*GridFile).insertChunk
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:650 +0x460
goroutine 12 [semacquire]:
sync.runtime_SemacquireMutex(0xc4200e6074)
/usr/local/go/src/runtime/sema.go:62 +0x34
sync.(*Mutex).Lock(0xc4200e6070)
/usr/local/go/src/sync/mutex.go:87 +0x9d
gopkg.in/mgo%2ev2.(*mongoSocket).SimpleQuery(0xc4200f20e0, 0xc4202e40e0, 0x6, 0x143fbe3, 0x5, 0xc4200e6060, 0xb)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:367 +0x28b
gopkg.in/mgo%2ev2.(*Database).run(0xc4200bc8e0, 0xc4200f20e0, 0x13d0f00, 0xc4200ee080, 0x13cbb00, 0xc4202e2060, 0x2, 0xc42005e400)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:3261 +0x1b3
gopkg.in/mgo%2ev2.(*Collection).writeOpCommand(0xc420019f20, 0xc4200f20e0, 0xc4200e2000, 0x139efa0, 0xc420018d20, 0x1010001, 0x2304558, 0x46, 0x8700c420023638)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4786 +0x1db
gopkg.in/mgo%2ev2.(*Collection).writeOp(0xc420019f20, 0x139efa0, 0xc420018d20, 0x100e501, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4645 +0x6dc
gopkg.in/mgo%2ev2.(*Collection).Insert(0xc420019f20, 0xc420010060, 0x1, 0x1, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:2437 +0xac
gopkg.in/mgo%2ev2.(*GridFile).insertChunk.func1(0x162c4e0, 0xc42013a000, 0x3fc3e, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:642 +0xe8
created by gopkg.in/mgo%2ev2.(*GridFile).insertChunk
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:650 +0x460
goroutine 38 [IO wait]:
net.runtime_pollWait(0x23a0f00, 0x77, 0x4)
/usr/local/go/src/runtime/netpoll.go:164 +0x59
net.(*pollDesc).wait(0xc4200fa068, 0x77, 0x15f84c0, 0x15f4540)
/usr/local/go/src/net/fd_poll_runtime.go:75 +0x38
net.(*pollDesc).waitWrite(0xc4200fa068, 0xc420392ef2, 0x2edd1)
/usr/local/go/src/net/fd_poll_runtime.go:84 +0x34
net.(*netFD).Write(0xc4200fa000, 0xc420382000, 0x3fcc3, 0x40000, 0x10ef2, 0x15f84c0, 0x15f4540)
/usr/local/go/src/net/fd_unix.go:340 +0x34d
net.(*conn).Write(0xc4200ea008, 0xc420382000, 0x3fcc3, 0x40000, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:193 +0x70
gopkg.in/mgo%2ev2.(*mongoSocket).Query(0xc4200f20e0, 0xc420181878, 0x1, 0x1, 0x0, 0x2)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:525 +0x2ad1
gopkg.in/mgo%2ev2.(*mongoSocket).SimpleQuery(0xc4200f20e0, 0xc4200f21c0, 0x6, 0x143fbe3, 0x5, 0xc420010631, 0xb)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:363 +0x22a
gopkg.in/mgo%2ev2.(*Database).run(0xc4200bc8e0, 0xc4200f20e0, 0x13d0f00, 0xc4202d4140, 0x13cbb00, 0xc4200f6000, 0x1444391, 0xc42002a800)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:3261 +0x1b3
gopkg.in/mgo%2ev2.(*Collection).writeOpCommand(0xc420019f20, 0xc4200f20e0, 0xc4200e2000, 0x139efa0, 0xc4200e8000, 0x1010001, 0x2306a28, 0x0, 0x800c4204a3e38)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4786 +0x1db
gopkg.in/mgo%2ev2.(*Collection).writeOp(0xc420019f20, 0x139efa0, 0xc4200e8000, 0xc4200e6001, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4645 +0x6dc
gopkg.in/mgo%2ev2.(*Collection).Insert(0xc420019f20, 0xc4200e6000, 0x1, 0x1, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:2437 +0xac
gopkg.in/mgo%2ev2.(*GridFile).insertChunk.func1(0x162c4e0, 0xc4204d8000, 0x3fc3e, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:642 +0xe8
created by gopkg.in/mgo%2ev2.(*GridFile).insertChunk
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:650 +0x460
goroutine 24 [semacquire]:
sync.runtime_SemacquireMutex(0xc4200f20e4)
/usr/local/go/src/runtime/sema.go:62 +0x34
sync.(*Mutex).Lock(0xc4200f20e0)
/usr/local/go/src/sync/mutex.go:87 +0x9d
gopkg.in/mgo%2ev2.(*mongoSocket).Acquire(0xc4200f20e0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/socket.go:242 +0x31
gopkg.in/mgo%2ev2.(*Session).acquireSocket(0xc4200e04e0, 0x0, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4419 +0x475
gopkg.in/mgo%2ev2.(*Collection).writeOp(0xc420019f20, 0x139efa0, 0xc4202d6000, 0x100e501, 0x0, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:4603 +0xd6
gopkg.in/mgo%2ev2.(*Collection).Insert(0xc420019f20, 0xc4202d2010, 0x1, 0x1, 0x0, 0x0)
/Users/IT/go/src/gopkg.in/mgo.v2/session.go:2437 +0xac
gopkg.in/mgo%2ev2.(*GridFile).insertChunk.func1(0x162c4e0, 0xc4205f8000, 0x3fc3e, 0x40000)
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:642 +0xe8
created by gopkg.in/mgo%2ev2.(*GridFile).insertChunk
/Users/IT/go/src/gopkg.in/mgo.v2/gridfs.go:650 +0x460
goroutine 14 [IO wait]:
net.runtime_pollWait(0x23a0d80, 0x72, 0x7)
/usr/local/go/src/runtime/netpoll.go:164 +0x59
net.(*pollDesc).wait(0xc420055728, 0x72, 0x15f84c0, 0x15f4540)
/usr/local/go/src/net/fd_poll_runtime.go:75 +0x38
net.(*pollDesc).waitRead(0xc420055728, 0xc420016b11, 0x1)
/usr/local/go/src/net/fd_poll_runtime.go:80 +0x34
net.(*netFD).Read(0xc4200556c0, 0xc420016b11, 0x1, 0x1, 0x0, 0x15f84c0, 0x15f4540)
/usr/local/go/src/net/fd_unix.go:250 +0x1b7
net.(*conn).Read(0xc42000e0a8, 0xc420016b11, 0x1, 0x1, 0x0, 0x0, 0x0)
/usr/local/go/src/net/net.go:181 +0x70
net/http.(*connReader).backgroundRead(0xc420016b00)
/usr/local/go/src/net/http/server.go:656 +0x58
created by net/http.(*connReader).startBackgroundRead
/usr/local/go/src/net/http/server.go:652 +0xdf
Process finished with exit code 2
I have found that in the write function there is a code look like this
file.assertMode(gfsWriting)
file.m.Lock()
debugf("GridFile %p: writing %d bytes", file, len(data))
defer file.m.Unlock()
if file.err != nil {
return 0, file.err
}
You are making a copy of the GridFile returned by GridFS.Create for no reason. Don't copy the struct, just return the pointer you are given.
GridFile contains private fields which cannot be copied, like a sync.Mutex and a sync.Cond. Running go vet on your code should catch these errors for you.

out of memory when generate cloudfoundry deploy manifest file cf-deployment.yml for openstack

I try use follow command to generate cloud foundry deployment file cf-deployment.yml in my VM(centos7 it already installed an openstack environment, rdo juno)
./generate_deployment_manifest openstack cf-stub.yml > cf-deployment.yml
the cf-stub.yml content is in follow
# The following line helps maintain current documentation at http://docs.cloudfoundry.org.
# code_snippet cf-stub-openstack start
---
director_uuid: 90c73a6e-4fd1-41bb-9282-299eb49af9fc
meta:
openstack:
net_id: 9e5a6fd5-fa2e-48da-94ce-f85337bc2451
auth_url: http://172.24.10.128:5000/v2.0
tenant: demo
username: demo
api_key: openstack
security_groups: [bosh]
floating_static_ips:
- 172.24.10.133
networks:
- name: cf1
subnets:
- cloud_properties:
static:
- 10.0.5.20 - 0.0.0.50
properties:
cc:
droplets:
droplet_directory_key: cloudfoundry-droplets
buildpacks:
buildpack_directory_key: cloudfoundry-buildpacks
staging_upload_user: update
staging_upload_password: openstack
bulk_api_password: openstack
db_encryption_key: openstack
ccdb:
roles:
- name: ccadmin
password: openstack
tag: admin
databases:
roles:
- name: ccadmin
password: openstack
- name: uaaadmin
password: openstack
dea_next:
disk_mb: 2048
memory_mb: 1024
domain: example.com
loggregator_endpoint:
shared_secret: openstack
nats:
user: nats
password: openstack
router:
enable_ssl: true
ssl_cert: |
-----BEGIN CERTIFICATE-----
MIIDBjCCAe4CCQCz3nn1SWrDdTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJB
VTETMBEGA1UECBMKU29tZS1TdGF0ZTEhMB8GA1UEChMYSW50ZXJuZXQgV2lkZ2l0
cyBQdHkgTHRkMB4XDTE1MDMwMzE4NTMyNloXDTE2MDMwMjE4NTMyNlowRTELMAkG
A1UEBhMCQVUxEzARBgNVBA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hkVbASzYGnMh+pKVH7rScSxto8v6/XBYT1Ez
7JOlMhD667/qvtFJtgIHkq7qzepbhnTv5x3tscQVnZY34/u9ILpD1s8dc+dibEvx
6S/gYLVorB5ois/DLMqaobRcew6Gs+XX9RPwmLahOJpZ9mh4XrOmCgPAYtP71YM9
ExpHCQKBgQCMMDDWGMRdFMJgXbx1uMere7OoniBdZaOexjbglRh1rMVSXqzBoU8+
yhEuHGAsHGWQdSBHnqRe9O0Bj/Vlw2VVEaJeL1ewRHb+jXSnuKclZOJgMsJAvgGm
SOWIahDrATA4g1T6yLBWQPhj3ZXD3eCMxT1Q3DvpG1DjgvXwmXQJAA==
-----END RSA PRIVATE KEY-----
cipher_suites: TLS_RSA_WITH_RC4_128_SHA:TLS_RSA_WITH_AES_128_CBC_SHA
status:
user: router_user
password: openstack
secure_cookies: true
uaa:
admin:
client_secret: openstack
batch:
username: batch
password: openstack
cc:
client_secret: openstack
clients:
app-direct:
secret: openstack
developer_console:
secret: openstack
notifications:
secret: openstack
login:
secret: openstack
doppler:
secret: openstack
cloud_controller_username_lookup:
secret: cloud_controller_username_lookup_secret
gorouter:
secret: openstack
jwt:
verification_key:
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw6WKxiVxx5+rqoMvj4vk
X5FpipdWaVLpcPhmN8O5ut2bqcU8KV6pMV7/n+zowITVFHCbS/6J6Uk875NclTC1
UI86Pxn3c+14KYL6KLe/Gi8McRyqvO5BpkQr3BTtBe9Z0EMgoeq5fAol2Lc/8SNz
/uLdSkMc5CmtpEgZ7isnsc8ExSDCchRmrCmKaxIPxNUZvCYgqqXXduHBln1/MBJV
YjsEXZZSbhLWzVaFOdAKkU9DlWxqI6sRWFSl6qZ3JCuMh3MQqLnFFXPAX8C9hxFV
oC2i7Fe6AIFyECJijgfieqi0PiBdMZ29Kj36gssktVhE+5TAcGCdFqdfzXOBC2ih
/wIDAQAB
-----END PUBLIC KEY-----
signing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NW/CLi7E9tvtzjnoFqdfDIaSbPV0CgYBhv56OcI4cN+1WcHjBHl0D
rG79RshjAZEW9LeP4gW/ayzQp6967GAY6wmZ+i26rVYSn8zl6b3p1wLcKF/0tw4M
BQzimQb/U+E7ntTOOi8YMxCVuBqimgd7FgxTpSogU0YZQHjMEUPGKXtvM+1Yi7vB
+6EgKPLJoX7DwkjYJ0o6AwKBgQC842gyn3SBDE2DfOuWvHUMmIt/Vl2lVZ5TGC4c
yOD2IvdA1gKi9XDi9qWEJqb9Z/YYxBv2nHyds9/jdjDkK/yatvUA/kSCJcP1xwkP
2zgN1if51UXBsHMXVTpd0C8pSs2FoLKrDnRoG8uu5BPVzh9+8OYApde011s806bm
oNrwgQKBgQCW/CUPXOrfyIwdFIEqSPB79GuV9e27cm8iB8Fu+Rcc3xlQc+3Ak97X
bLi2C1to/pMX+q8ksudd1jOMoyhufle8wJaxC0jLgVx4DGUorvA0uiVtEAULreXz
beE4LXyvVu+tYIl4ATlIyEQSAnNIR6oCX5KvQJu+jHA4i9z+Vg0mpA==
-----END RSA PRIVATE KEY-----
scim:
users:
- admin|openstack|scim.write,scim.read,openid,cloud_controller.admin,doppler.firehose
uaadb:
roles:
- name: uaaadmin
password: openstack
tag: admin
# code_snippet cf-stub-openstack end
# The previous line helps maintain current documentation at http://docs.cloudfoundry.org.
then I get the error
./generate_deployment_manifest openstack cf-stub.yml > cf-deployment.yml
fatal error: runtime: out of memory
runtime stack:
runtime.SysMap(0xc3d3860000, 0x72eb0000, 0x754900, 0x75ca58)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/mem_linux.c:149 +0x98
runtime.MHeap_SysAlloc(0x762140, 0x72eb0000, 0x429d02)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/malloc.c:284 +0x124
runtime.MHeap_Alloc(0x762140, 0x39755, 0x10100000000, 0xc208000120)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/mheap.c:240 +0x66
goroutine 1 [running]:
runtime.switchtoM()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:198 fp=0xc208141858 sp=0xc208141850
runtime.mallocgc(0x72ea9ff0, 0x61e9e0, 0x0, 0x73c280)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/malloc.go:199 +0x9f3 fp=0xc208141908 sp=0xc208141858
runtime.newarray(0x61e9e0, 0x4c9c6aa, 0x57be3e)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/malloc.go:365 +0xc1 fp=0xc208141940 sp=0xc208141908
runtime.growslice(0x5946c0, 0xc377970000, 0x3d49eaa, 0x3d49eaa, 0x1, 0x0, 0x0, 0x0)
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/slice.go:87 +0x2bb fp=0xc2081419a0 sp=0xc208141940
github.com/cloudfoundry-incubator/spiff/dynaml.ipRange(0xc208156cd0, 0x10, 0x10, 0xc208156d20, 0x10, 0x10, 0x0, 0x0, 0x0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/dynaml/call.go:187 +0x221 fp=0xc208141a58 sp=0xc2081419a0
github.com/cloudfoundry-incubator/spiff/dynaml.staticIPPool(0xc208156c90, 0x1, 0x1, 0x0, 0x0, 0x0, 0xc208141be0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/dynaml/call.go:173 +0x296 fp=0xc208141b88 sp=0xc208141a58
github.com/cloudfoundry-incubator/spiff/dynaml.generateStaticIPs(0x7f63bde43170, 0xc208046370, 0xc2081564c8, 0x1, 0x1, 0x0, 0x0, 0x600000000000000)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/dynaml/call.go:63 +0x16f fp=0xc208141ca0 sp=0xc208141b88
github.com/cloudfoundry-incubator/spiff/dynaml.CallExpr.Evaluate(0xc208156211, 0xa, 0xc2081560b0, 0x1, 0x1, 0x7f63bde43170, 0xc208046370, 0x0, 0x0, 0xc208141e00)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/dynaml/call.go:33 +0x2bc fp=0xc208141d88 sp=0xc208141ca0
github.com/cloudfoundry-incubator/spiff/dynaml.(*CallExpr).Evaluate(0xc20810c9f0, 0x7f63bde43170, 0xc208046370, 0x0, 0x0, 0xc208046370)
<autogenerated>:11 +0xc6 fp=0xc208141de0 sp=0xc208141d88
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc2080b85c0, 0xc208208060, 0x3, 0x4, 0xc20800a500, 0x5, 0x8, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:49 +0x2df fp=0xc208141f08 sp=0xc208141de0
github.com/cloudfoundry-incubator/spiff/flow.flowMap(0x7f63bde41ef0, 0xc2080b8600, 0xc208208060, 0x3, 0x4, 0xc208034600, 0x4, 0x6, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:98 +0x8c7 fp=0xc208142278 sp=0xc208141f08
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc2080b8600, 0xc208156b10, 0x2, 0x2, 0xc208034600, 0x4, 0x6, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:43 +0x131 fp=0xc2081423a0 sp=0xc208142278
github.com/cloudfoundry-incubator/spiff/flow.flowList(0x7f63bde41ef0, 0xc2080b8660, 0xc208156b10, 0x2, 0x2, 0xc208145580, 0x3, 0x4, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:113 +0x420 fp=0xc208142600 sp=0xc2081423a0
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc2080b8660, 0xc208156b10, 0x2, 0x2, 0xc208145580, 0x3, 0x4, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:46 +0x1ed fp=0xc208142728 sp=0xc208142600
github.com/cloudfoundry-incubator/spiff/flow.flowMap(0x7f63bde41ef0, 0xc2080b87e0, 0xc208156b10, 0x2, 0x2, 0xc208149ea0, 0x2, 0x2, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:98 +0x8c7 fp=0xc208142a98 sp=0xc208142728
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc2080b87e0, 0xc2080440c8, 0x1, 0x1, 0xc208149ea0, 0x2, 0x2, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:43 +0x131 fp=0xc208142bc0 sp=0xc208142a98
github.com/cloudfoundry-incubator/spiff/flow.flowList(0x7f63bde41ef0, 0xc208148fc0, 0xc2080440c8, 0x1, 0x1, 0xc208156a70, 0x1, 0x1, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:113 +0x420 fp=0xc208142e20 sp=0xc208142bc0
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc208148fc0, 0xc2080440c8, 0x1, 0x1, 0xc208156a70, 0x1, 0x1, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:46 +0x1ed fp=0xc208142f48 sp=0xc208142e20
github.com/cloudfoundry-incubator/spiff/flow.flowMap(0x7f63bde41ef0, 0xc208149b80, 0xc2080440c8, 0x1, 0x1, 0x0, 0x0, 0x0, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:98 +0x8c7 fp=0xc2081432b8 sp=0xc208142f48
github.com/cloudfoundry-incubator/spiff/flow.flow(0x7f63bde41ef0, 0xc208149b80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xc20800a340, 0x1, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:43 +0x131 fp=0xc2081433e0 sp=0xc2081432b8
github.com/cloudfoundry-incubator/spiff/flow.Flow(0x7f63bde41ef0, 0xc20801f2c0, 0xc20800a340, 0x1, 0x4, 0x0, 0x0, 0x0, 0x0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/flow.go:19 +0xd6 fp=0xc208143500 sp=0xc2081433e0
github.com/cloudfoundry-incubator/spiff/flow.Cascade(0x7f63bde41ef0, 0xc208073960, 0xc20800a300, 0x5, 0x8, 0x0, 0x0, 0x0, 0x0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/flow/cascade.go:9 +0x100 fp=0xc208143590 sp=0xc208143500
main.merge(0x7fffddc9a701, 0x1d, 0xc20800a030, 0x5, 0x5)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/spiff.go:90 +0xd0c fp=0xc208143770 sp=0xc208143590
main.funcĀ·001(0xc20807a1c0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/spiff.go:36 +0x124 fp=0xc2081437e8 sp=0xc208143770
github.com/codegangsta/cli.Command.Run(0x63a750, 0x5, 0x63a510, 0x1, 0x0, 0x0, 0x0, 0x67e3f0, 0x29, 0x0, ...)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/Godeps/_workspace/src/github.com/codegangsta/cli/command.go:118 +0x104b fp=0xc208143be8 sp=0xc2081437e8
github.com/codegangsta/cli.(*App).Run(0xc20806c0f0, 0xc20800a000, 0x8, 0x8, 0x0, 0x0)
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/Godeps/_workspace/src/github.com/codegangsta/cli/app.go:177 +0xdf6 fp=0xc208143ee8 sp=0xc208143be8
main.main()
/Users/fraenkel/go/src/github.com/cloudfoundry-incubator/spiff/spiff.go:60 +0x292 fp=0xc208143f98 sp=0xc208143ee8
runtime.main()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/proc.go:63 +0xf3 fp=0xc208143fe0 sp=0xc208143f98
runtime.goexit()
/usr/local/Cellar/go/1.4.2/libexec/src/runtime/asm_amd64.s:2232 +0x1 fp=0xc208143fe8 sp=0xc208143fe0
even I config my vm to 10g ram, the error still there, this let me start to think it may be not a memory issue. so I ask here.
does any body can give me some advice ?
thanks in advance.
this error cause by the - 10.0.5.20 - 0.0.0.50 ip error, if the ip is not in same net xxx.xxx.xxx.xxx- xxx.xxx.yyy.xxx will cause OOM error